avcodec/movtextdec: check that ftab has been allocated before dereferencing it

Fixes potential null pointer dereference on deallocation

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2015-08-06 22:40:01 +02:00
parent 2e7a684e72
commit ae413a48e6

View File

@ -93,9 +93,11 @@ static void mov_text_cleanup(MovTextContext *m)
static void mov_text_cleanup_ftab(MovTextContext *m)
{
int i;
for(i = 0; i < m->count_f; i++) {
av_freep(&m->ftab[i]->font);
av_freep(&m->ftab[i]);
if (m->ftab) {
for(i = 0; i < m->count_f; i++) {
av_freep(&m->ftab[i]->font);
av_freep(&m->ftab[i]);
}
}
av_freep(&m->ftab);
}