diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-06-14 04:22:32 +0300 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-07-02 11:15:09 +0300 |
commit | 7f46b16cb24e0f8ef069bcd8f0418c9197141cf7 (patch) | |
tree | f8903d0f76328b8f8a460d76b311750252cf9f28 /libavformat | |
parent | c334959666521a65fcb256c6ae252abbfa5d7262 (diff) |
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 89d21b9c1f..371d2d9d13 100644 --- a/libavformat/sccdec.c +++ b/libavformat/sccdec.c @@ -132,7 +132,7 @@ static int scc_read_header(AVFormatContext *s) sub = ff_subtitles_queue_insert(&scc->q, out, i, 0); if (!sub) - return AVERROR(ENOMEM); + goto fail; sub->pos = pos; sub->pts = ts_start; @@ -144,6 +144,9 @@ static int scc_read_header(AVFormatContext *s) 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) |