Commit af09be4f authored by Wim Vander Schelden's avatar Wim Vander Schelden Committed by Michael Niedermayer

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

Fixed a memory leak in dvbsubenc.c: sub->num_rects was reduced without freeing the associated rects.
Signed-off-by: 's avatarWim Vander Schelden <lists@fixnum.org>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 2efdccac
...@@ -1384,7 +1384,13 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf, ...@@ -1384,7 +1384,13 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
offset_y = display_def->y; 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){ if (sub->num_rects > 0){
sub->rects = av_mallocz(sizeof(*sub->rects) * sub->num_rects); 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, ...@@ -1437,8 +1443,6 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
i++; i++;
} }
sub->num_rects = i;
} }
#ifdef DEBUG #ifdef DEBUG
save_display_set(ctx); save_display_set(ctx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment