Commit a9500441 authored by Paul B Mahol's avatar Paul B Mahol

avfilter/vf_copy: check for error cases and handle them

parent c9473229
...@@ -48,15 +48,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) ...@@ -48,15 +48,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{ {
AVFilterLink *outlink = inlink->dst->outputs[0]; AVFilterLink *outlink = inlink->dst->outputs[0];
AVFrame *out = ff_get_video_buffer(outlink, in->width, in->height); AVFrame *out = ff_get_video_buffer(outlink, in->width, in->height);
int ret;
if (!out) { if (!out)
av_frame_free(&in); ret = AVERROR(ENOMEM);
return AVERROR(ENOMEM);
} ret = av_frame_copy_props(out, in);
av_frame_copy_props(out, in); if (ret < 0)
av_frame_copy(out, in); goto fail;
ret = av_frame_copy(out, in);
if (ret < 0)
goto fail;
av_frame_free(&in); av_frame_free(&in);
return ff_filter_frame(outlink, out); return ff_filter_frame(outlink, out);
fail:
av_frame_free(&in);
av_frame_free(&out);
return ret;
} }
static const AVFilterPad avfilter_vf_copy_inputs[] = { static const AVFilterPad avfilter_vf_copy_inputs[] = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment