From e8206b63ad76dd1b71d2be5fc81645c2407f5376 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 21 Sep 2019 13:43:19 +0200 Subject: [PATCH] avformat/mpsubdec: Clear queue on error Fixes: Memleaks Fixes: 17219/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5720539124989952 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 9a0d36e562d53716cf000895c2f892fb1f48165d) Signed-off-by: Michael Niedermayer --- libavformat/mpsubdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/mpsubdec.c b/libavformat/mpsubdec.c index 1236efa712..fc1731f26e 100644 --- a/libavformat/mpsubdec.c +++ b/libavformat/mpsubdec.c @@ -106,6 +106,9 @@ static int mpsub_read_header(AVFormatContext *s) ff_subtitles_queue_finalize(s, &mpsub->q); end: + if (res < 0) + ff_subtitles_queue_clean(&mpsub->q); + av_bprint_finalize(&buf, NULL); return res; }