[FFmpeg-devel] [PATCH] avfilter/drawtext: fix frame mem leak

Ivan Efimov ioefimov at gmail.com
Fri Apr 10 16:28:45 CEST 2015


Signed-off-by: Ivan Efimov <ioefimov at gmail.com>
---
This fixes memory leak in drawtext in case of textfile load error

 libavfilter/vf_drawtext.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 37eb231..cf17a55 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -1275,12 +1275,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
     int ret;
 
     if (s->reload) {
-        if ((ret = load_textfile(ctx)) < 0)
+        if ((ret = load_textfile(ctx)) < 0) {
+            av_frame_free(&frame);
             return ret;
+        }
 #if CONFIG_LIBFRIBIDI
         if (s->text_shaping)
-            if ((ret = shape_text(ctx)) < 0)
+            if ((ret = shape_text(ctx)) < 0) {
+                av_frame_free(&frame);
                 return ret;
+            }
 #endif
     }
 
-- 
2.1.4



More information about the ffmpeg-devel mailing list