summaryrefslogtreecommitdiff
path: root/libavfilter/avfilter.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-01-10 03:46:28 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-01-10 03:46:28 +0100
commitd9481dcd612b5f020e3c2137c301406a5eb1aa90 (patch)
tree079ebab7bc934fa9a9695ca22b3e56e74fe1b26d /libavfilter/avfilter.c
parent8788d316062e8afe456123a00c594e598fa80408 (diff)
parentabb5e37f64c48bba8bd0fde2bada0f7544defa24 (diff)
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>
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r--libavfilter/avfilter.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 269ba8e064..f9f6d6c83a 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -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)