]> git.sesse.net Git - ffmpeg/commitdiff
avformat/lrcdec: Fix memleak upon read header failure
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 14 Jun 2020 01:12:00 +0000 (03:12 +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/lrcdec.c

index a9a117691acedb3bdeca53c3426a2becd7fce375..46d5e2bc6a219f084f3f194b19118b3e34438d57 100644 (file)
@@ -202,6 +202,7 @@ static int lrc_read_header(AVFormatContext *s)
                 sub = ff_subtitles_queue_insert(&lrc->q, line.str + ts_strlength,
                                                 line.len - ts_strlength, 0);
                 if(!sub) {
+                    ff_subtitles_queue_clean(&lrc->q);
                     return AVERROR(ENOMEM);
                 }
                 sub->pos = pos;