[FFmpeg-cvslog] Fixed a memory leak in dvbsubenc.c: sub-> num_rects was reduced without freeing the associated rects.

Wim Vander Schelden git at videolan.org
Sat Jan 25 01:32:29 CET 2014


ffmpeg | branch: master | Wim Vander Schelden <lists at fixnum.org> | Tue Jan 21 14:38:16 2014 +0100| [af09be4f4b2f87e71a3396f54c24a166092ec8e3] | committer: Michael Niedermayer

Fixed a memory leak in dvbsubenc.c: sub->num_rects was reduced without freeing the associated rects.

Signed-off-by: Wim Vander Schelden <lists at fixnum.org>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/dvbsubdec.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 8f4e984..999b3fa 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -1384,7 +1384,13 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
         offset_y = display_def->y;
     }
 
-    sub->num_rects = ctx->display_list_size;
+    sub->num_rects = 0;
+    for (display = ctx->display_list; display; display = display->next)
+    {
+        region = get_region(ctx, display->region_id);
+        if (region && region->dirty)
+            sub->num_rects++;
+    }
 
     if (sub->num_rects > 0){
         sub->rects = av_mallocz(sizeof(*sub->rects) * sub->num_rects);
@@ -1437,8 +1443,6 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
 
         i++;
     }
-
-    sub->num_rects = i;
     }
 #ifdef DEBUG
     save_display_set(ctx);



More information about the ffmpeg-cvslog mailing list