Merge commit 'abb5e37f64c48bba8bd0fde2bada0f7544defa24'

* commit 'abb5e37f64c48bba8bd0fde2bada0f7544defa24':
  avfilter: fix leaks on error in ff_filter_frame

Conflicts:
	libavfilter/avfilter.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-01-10 03:46:28 +01:00
commit d9481dcd61
1 changed files with 17 additions and 5 deletions

View File

@ -1024,13 +1024,18 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
case AVMEDIA_TYPE_AUDIO:
out = ff_get_audio_buffer(link, frame->nb_samples);
break;
default: return AVERROR(EINVAL);
default:
ret = AVERROR(EINVAL);
goto fail;
}
if (!out) {
av_frame_free(&frame);
return AVERROR(ENOMEM);
ret = AVERROR(ENOMEM);
goto fail;
}
av_frame_copy_props(out, frame);
ret = av_frame_copy_props(out, frame);
if (ret < 0)
goto fail;
switch (link->type) {
case AVMEDIA_TYPE_VIDEO:
@ -1043,7 +1048,9 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
av_get_channel_layout_nb_channels(frame->channel_layout),
frame->format);
break;
default: return AVERROR(EINVAL);
default:
ret = AVERROR(EINVAL);
goto fail;
}
av_frame_free(&frame);
@ -1076,6 +1083,11 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
link->frame_requested = 0;
ff_update_link_current_pts(link, pts);
return ret;
fail:
av_frame_free(&out);
av_frame_free(&frame);
return ret;
}
static int ff_filter_frame_needs_framing(AVFilterLink *link, AVFrame *frame)