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

Jun Zhao mypopydev at gmail.com
Wed Jun 13 16:48:58 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.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index d4ac690..cbe89a9 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1832,13 +1832,13 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
         avio_write(progress_avio, buf_script.str,
                    FFMIN(buf_script.len, buf_script.size - 1));
         avio_flush(progress_avio);
-        av_bprint_finalize(&buf_script, NULL);
         if (is_last_report) {
             if ((ret = avio_closep(&progress_avio)) < 0)
                 av_log(NULL, AV_LOG_ERROR,
                        "Error closing progress log, loss of information possible: %s\n", av_err2str(ret));
         }
     }
+    av_bprint_finalize(&buf_script, NULL);
 
     if (is_last_report)
         print_final_stats(total_size);
-- 
2.7.4



More information about the ffmpeg-devel mailing list