summaryrefslogtreecommitdiffstats
path: root/libavcodec/movtextdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-08-31 23:43:43 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-08-31 23:44:39 +0200
commita047ccbb9fad2c33db7ebc40b95e34ea6ee89c21 (patch)
tree7c293fec348d99eaf865ac83e7bd2ff417f6e9dd /libavcodec/movtextdec.c
parenta1a32fdb0ee63783d06c63b7d90bb382eea356ce (diff)
downloadffmpeg-streaming-a047ccbb9fad2c33db7ebc40b95e34ea6ee89c21.zip
ffmpeg-streaming-a047ccbb9fad2c33db7ebc40b95e34ea6ee89c21.tar.gz
avcodec/movtextdec: Free ftab_temp
Fixes memleak Fixes: efe937780e95574250dabe07151bdc23/unknown_unknown_351_849_cov_3187578556_shellymanne.mov Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/movtextdec.c')
-rw-r--r--libavcodec/movtextdec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index bdef856..257d598 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -121,6 +121,9 @@ static void mov_text_cleanup(MovTextContext *m)
static void mov_text_cleanup_ftab(MovTextContext *m)
{
int i;
+ if (m->ftab_temp)
+ av_freep(&m->ftab_temp->font);
+ av_freep(&m->ftab_temp);
if (m->ftab) {
for(i = 0; i < m->count_f; i++) {
av_freep(&m->ftab[i]->font);
@@ -210,7 +213,7 @@ static int mov_text_tx3g(AVCodecContext *avctx, MovTextContext *m)
m->ftab_entries = 0;
return -1;
}
- m->ftab_temp = av_malloc(sizeof(*m->ftab_temp));
+ m->ftab_temp = av_mallocz(sizeof(*m->ftab_temp));
if (!m->ftab_temp) {
mov_text_cleanup_ftab(m);
return AVERROR(ENOMEM);
@@ -237,6 +240,7 @@ static int mov_text_tx3g(AVCodecContext *avctx, MovTextContext *m)
mov_text_cleanup_ftab(m);
return AVERROR(ENOMEM);
}
+ m->ftab_temp = NULL;
tx3g_ptr = tx3g_ptr + font_length;
}
for (i = 0; i < m->ftab_entries; i++) {
OpenPOWER on IntegriCloud