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

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

index 82c73457ead69b2813ad2bb836a3b7a58ad44814..e7b83a1d85f1f5531392646fcc5fdd164e202169 100644 (file)
@@ -154,8 +154,10 @@ static int mpsub_read_header(AVFormatContext *s)
     }
 
     st = avformat_new_stream(s, NULL);
-    if (!st)
-        return AVERROR(ENOMEM);
+    if (!st) {
+        res = AVERROR(ENOMEM);
+        goto end;
+    }
     avpriv_set_pts_info(st, 64, pts_info.den, pts_info.num);
     st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
     st->codecpar->codec_id   = AV_CODEC_ID_TEXT;