aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/jacosubdec.c
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-07-02 01:01:30 +0200
commitaad3e8af01ba88f5c53673896eb2188de5823009 (patch)
tree45de7e890a7bffc06ca2c9df1646275ec03857b9 /libavformat/jacosubdec.c
parentbe57a2ce9efaa7ce5ed4d7e2d4d873f2a71137b4 (diff)
downloadffmpeg-aad3e8af01ba88f5c53673896eb2188de5823009.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> (cherry picked from commit c13a752733a9af955b032c55f704b748fe37dd19) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/jacosubdec.c')
-rw-r--r--libavformat/jacosubdec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 520c435cc5..87dc649485 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -187,8 +187,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;