diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-06-14 03:22:32 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-07-01 21:37:21 +0200 |
commit | 6b7af5991ae6501afcaf911f8fc7a02eb758b09c (patch) | |
tree | 319d381bb46ed4c1c89d8dfc39001826fbe74778 /libavformat | |
parent | 5c9f00b47ea49425a3df3f0de4bea4c02d97e739 (diff) | |
download | ffmpeg-6b7af5991ae6501afcaf911f8fc7a02eb758b09c.tar.gz |
avformat/sccdec: Fix memleak upon read header failure
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>
(cherry picked from commit f3c63e67bb00fa7d96595203d01a576df651e275)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/sccdec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/sccdec.c b/libavformat/sccdec.c index 412d8aaf49..b0b3ac1005 100644 --- a/libavformat/sccdec.c +++ b/libavformat/sccdec.c @@ -133,7 +133,7 @@ try_again: sub = ff_subtitles_queue_insert(&scc->q, out, i, 0); if (!sub) - return AVERROR(ENOMEM); + goto fail; sub->pos = pos; sub->pts = ts_start; @@ -149,6 +149,9 @@ try_again: ff_subtitles_queue_finalize(s, &scc->q); return ret; +fail: + ff_subtitles_queue_clean(&scc->q); + return AVERROR(ENOMEM); } static int scc_read_packet(AVFormatContext *s, AVPacket *pkt) |