]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mpl2dec: Fix memleak upon read header failure
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 14 Jun 2020 01:19:32 +0000 (03:19 +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 reading a subsequent subtitle.

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

index ddee638c3192e29ade48a825f708b8e78202aaf1..bea258d9e9a9df9973507b451751d76ee92b0c87 100644 (file)
@@ -111,8 +111,10 @@ static int mpl2_read_header(AVFormatContext *s)
             AVPacket *sub;
 
             sub = ff_subtitles_queue_insert(&mpl2->q, p, strlen(p), 0);
-            if (!sub)
+            if (!sub) {
+                ff_subtitles_queue_clean(&mpl2->q);
                 return AVERROR(ENOMEM);
+            }
             sub->pos = pos;
             sub->pts = pts_start;
             sub->duration = duration;