aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-14 03:09:08 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-15 16:54:05 +0200
commitc13a752733a9af955b032c55f704b748fe37dd19 (patch)
tree896352b59a5c74d85671715f33aef29f1a5bd1dd /libavformat
parent5ab39c2d8c1e5e00b48d758eee7d5ae435a99ef7 (diff)
downloadffmpeg-c13a752733a9af955b032c55f704b748fe37dd19.tar.gz
avformat/jacosubdec: 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>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/jacosubdec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 121c86d659..3414eb3938 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -188,8 +188,10 @@ static int jacosub_read_header(AVFormatContext *s)
AVPacket *sub;
sub = ff_subtitles_queue_insert(&jacosub->q, line, len, merge_line);
- if (!sub)
- return AVERROR(ENOMEM);
+ if (!sub) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
sub->pos = pos;
merge_line = len > 1 && !strcmp(&line[len - 2], "\\\n");
continue;