]> git.sesse.net Git - ffmpeg/commitdiff
avformat/subviewerdec: Fix memleak upon read header failure
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 14 Jun 2020 01:27:11 +0000 (03:27 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 15 Jun 2020 14:54:06 +0000 (16:54 +0200)
The already parsed subtitles (contained in an FFDemuxSubtitlesQueue)
would leak if an error happened upon reading a subsequent subtitle.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/subviewerdec.c

index 83378eab5f91047bf76f22d7997cbedf37537fe6..fdca3a48205dfecc453d9c9d4c65c376f5095b12 100644 (file)
@@ -172,6 +172,8 @@ static int subviewer_read_header(AVFormatContext *s)
     ff_subtitles_queue_finalize(s, &subviewer->q);
 
 end:
+    if (res < 0)
+        ff_subtitles_queue_clean(&subviewer->q);
     av_bprint_finalize(&header, NULL);
     return res;
 }