Commit a047ccbb authored by Michael Niedermayer's avatar Michael Niedermayer

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: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent a1a32fdb
......@@ -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++) {
......
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