diff --git a/libavformat/mpsubdec.c b/libavformat/mpsubdec.c index 3d8dcb35c2..82c73457ea 100644 --- a/libavformat/mpsubdec.c +++ b/libavformat/mpsubdec.c @@ -163,6 +163,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; }