diff mbox series

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

Message ID 20200614223656.21338-10-andreas.rheinhardt@gmail.com
State Accepted
Commit d38694cea9f289b3f9dcce1a2f07746d029b35f3
Headers show
Series [FFmpeg-devel,01/26] avformat/matroskadec: Move AVBufferRef instead of copying, fix memleak | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt June 14, 2020, 10:36 p.m. UTC
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 | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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;