avformat/aadec: Fix leak on error

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2021-03-24 03:23:37 +01:00
parent 4f11685e4c
commit 3ec3370dea

View File

@ -229,8 +229,11 @@ static int aa_read_header(AVFormatContext *s)
chapter_pos -= start + CHAPTER_HEADER_SIZE * chapter_idx;
avio_skip(pb, 4 + chapter_size);
if (!avpriv_new_chapter(s, chapter_idx, st->time_base,
chapter_pos * TIMEPREC, (chapter_pos + chapter_size) * TIMEPREC, NULL))
return AVERROR(ENOMEM);
chapter_pos * TIMEPREC,
(chapter_pos + chapter_size) * TIMEPREC, NULL)) {
av_freep(&c->tea_ctx);
return AVERROR(ENOMEM);
}
}
st->duration = (largest_size - CHAPTER_HEADER_SIZE * s->nb_chapters) * TIMEPREC;