[FFmpeg-devel] [PATCH 2/2] fftools/ffmpeg_filter: fix memory leak issue.

Jun Zhao mypopydev at gmail.com
Wed Jun 13 16:48:59 EEST 2018


need to call av_bprint_finalize to free the memory source to match
av_bprint_init.

Signed-off-by: Jun Zhao <mypopydev at gmail.com>
---
 fftools/ffmpeg_filter.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 068f499..a294e43 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -789,8 +789,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)
+                                            args.str, NULL, fg->graph)) < 0) {
+        av_bprint_finalize(&args, NULL);
         goto fail;
+    }
+    av_bprint_finalize(&args, NULL);
     par->hw_frames_ctx = ifilter->hw_frames_ctx;
     ret = av_buffersrc_parameters_set(ifilter->filter, par);
     if (ret < 0)
@@ -890,8 +893,11 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,
 
     if ((ret = avfilter_graph_create_filter(&ifilter->filter, abuffer_filt,
                                             name, args.str, NULL,
-                                            fg->graph)) < 0)
+                                            fg->graph)) < 0) {
+        av_bprint_finalize(&args, NULL);
         return ret;
+    }
+    av_bprint_finalize(&args, NULL);
     last_filter = ifilter->filter;
 
 #define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg) do {                 \
-- 
2.7.4



More information about the ffmpeg-devel mailing list