aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-14 03:22:32 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-15 17:30:28 +0200
commitbf29cf8eb6f5fadcec2c32522612eb0c453e2581 (patch)
treeb53acda051ceca0e24e43d4d29fef94c3849ca7d /libavformat
parent6e64260a190a9549d12953dc779cb88e69cdaaac (diff)
downloadffmpeg-bf29cf8eb6f5fadcec2c32522612eb0c453e2581.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)
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/sccdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/sccdec.c b/libavformat/sccdec.c
index b9042b39ac..df4c94a6ea 100644
--- a/libavformat/sccdec.c
+++ b/libavformat/sccdec.c
@@ -136,7 +136,7 @@ try_again:
sub = ff_subtitles_queue_insert(&scc->q, out, i, 0);
if (!sub)
- return AVERROR(ENOMEM);
+ goto fail;
sub->pos = current_pos;
sub->pts = ts_start;
@@ -155,6 +155,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)