[FFmpeg-cvslog] ffmpeg_filter: Fix AVBufferSrcParameters leak

Michael Niedermayer git at videolan.org
Thu May 19 01:19:23 CEST 2016


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu May 19 00:10:27 2016 +0200| [4a81bddb4d9bd6402fc3be64ca406dda7976058d] | committer: Michael Niedermayer

ffmpeg_filter: Fix AVBufferSrcParameters leak

Fixed: CID1361950

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a81bddb4d9bd6402fc3be64ca406dda7976058d
---

 ffmpeg_filter.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 1608eb1..7745cb6 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -728,7 +728,8 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
 
     if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
         av_log(NULL, AV_LOG_ERROR, "Cannot connect video filter to audio input\n");
-        return AVERROR(EINVAL);
+        ret = AVERROR(EINVAL);
+        goto fail;
     }
 
     if (!fr.num)
@@ -737,7 +738,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
     if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_SUBTITLE) {
         ret = sub2video_prepare(ist);
         if (ret < 0)
-            return ret;
+            goto fail;
     }
 
     sar = ist->st->sample_aspect_ratio.num ?
@@ -761,11 +762,11 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
 
     if ((ret = avfilter_graph_create_filter(&ifilter->filter, buffer_filt, name,
                                             args.str, NULL, fg->graph)) < 0)
-        return ret;
+        goto fail;
     par->hw_frames_ctx = ist->hw_frames_ctx;
     ret = av_buffersrc_parameters_set(ifilter->filter, par);
     if (ret < 0)
-        return ret;
+        goto fail;
     av_freep(&par);
     last_filter = ifilter->filter;
 
@@ -840,6 +841,10 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
     if ((ret = avfilter_link(last_filter, 0, in->filter_ctx, in->pad_idx)) < 0)
         return ret;
     return 0;
+fail:
+    av_freep(&par);
+
+    return ret;
 }
 
 static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,



More information about the ffmpeg-cvslog mailing list