[FFmpeg-devel] [PATCH 10/26] avformat/lrcdec: Fix memleak upon read header failure

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Mon Jun 15 01:36:40 EEST 2020


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 at gmail.com>
---
 libavformat/lrcdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/lrcdec.c b/libavformat/lrcdec.c
index a9a117691a..46d5e2bc6a 100644
--- a/libavformat/lrcdec.c
+++ b/libavformat/lrcdec.c
@@ -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;
-- 
2.20.1



More information about the ffmpeg-devel mailing list