mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-04-26 13:18:08 +00:00
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>
This commit is contained in:
parent
a1a32fdb0e
commit
a047ccbb9f
@ -121,6 +121,9 @@ static void mov_text_cleanup(MovTextContext *m)
|
|||||||
static void mov_text_cleanup_ftab(MovTextContext *m)
|
static void mov_text_cleanup_ftab(MovTextContext *m)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
if (m->ftab_temp)
|
||||||
|
av_freep(&m->ftab_temp->font);
|
||||||
|
av_freep(&m->ftab_temp);
|
||||||
if (m->ftab) {
|
if (m->ftab) {
|
||||||
for(i = 0; i < m->count_f; i++) {
|
for(i = 0; i < m->count_f; i++) {
|
||||||
av_freep(&m->ftab[i]->font);
|
av_freep(&m->ftab[i]->font);
|
||||||
@ -210,7 +213,7 @@ static int mov_text_tx3g(AVCodecContext *avctx, MovTextContext *m)
|
|||||||
m->ftab_entries = 0;
|
m->ftab_entries = 0;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
m->ftab_temp = av_malloc(sizeof(*m->ftab_temp));
|
m->ftab_temp = av_mallocz(sizeof(*m->ftab_temp));
|
||||||
if (!m->ftab_temp) {
|
if (!m->ftab_temp) {
|
||||||
mov_text_cleanup_ftab(m);
|
mov_text_cleanup_ftab(m);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
@ -237,6 +240,7 @@ static int mov_text_tx3g(AVCodecContext *avctx, MovTextContext *m)
|
|||||||
mov_text_cleanup_ftab(m);
|
mov_text_cleanup_ftab(m);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
|
m->ftab_temp = NULL;
|
||||||
tx3g_ptr = tx3g_ptr + font_length;
|
tx3g_ptr = tx3g_ptr + font_length;
|
||||||
}
|
}
|
||||||
for (i = 0; i < m->ftab_entries; i++) {
|
for (i = 0; i < m->ftab_entries; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user