aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-10-01 13:45:29 +0200
committerPaul B Mahol <onemda@gmail.com>2019-10-01 13:45:29 +0200
commita9500441a71805da13389d4a56188c90f6bc013e (patch)
tree2d971daa661d52e6d4d43b9a25cd771b2d7b8631 /libavfilter
parentc9473229c9ecffaedbeb3a1d9fe3dbf2d8aee054 (diff)
downloadffmpeg-a9500441a71805da13389d4a56188c90f6bc013e.tar.gz
avfilter/vf_copy: check for error cases and handle them
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_copy.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/libavfilter/vf_copy.c b/libavfilter/vf_copy.c
index b0159cff00..a59e024e87 100644
--- a/libavfilter/vf_copy.c
+++ b/libavfilter/vf_copy.c
@@ -48,15 +48,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *out = ff_get_video_buffer(outlink, in->width, in->height);
+ int ret;
- if (!out) {
- av_frame_free(&in);
- return AVERROR(ENOMEM);
- }
- av_frame_copy_props(out, in);
- av_frame_copy(out, in);
+ if (!out)
+ ret = AVERROR(ENOMEM);
+
+ ret = av_frame_copy_props(out, in);
+ if (ret < 0)
+ goto fail;
+ ret = av_frame_copy(out, in);
+ if (ret < 0)
+ goto fail;
av_frame_free(&in);
return ff_filter_frame(outlink, out);
+fail:
+ av_frame_free(&in);
+ av_frame_free(&out);
+ return ret;
}
static const AVFilterPad avfilter_vf_copy_inputs[] = {