summaryrefslogtreecommitdiff
path: root/libavformat/mpsubdec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-14 03:20:09 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-15 16:54:05 +0200
commita5ed8aeea4f4199e89520c3fdbd9d07ae7fc3c3f (patch)
treeaeff99959c2b23bdba7aaddbe8a3c438fe47874a /libavformat/mpsubdec.c
parent331799747e7e995710f5dfc4d413cda35eb01289 (diff)
downloadffmpeg-a5ed8aeea4f4199e89520c3fdbd9d07ae7fc3c3f.tar.gz
avformat/mpsubdec: Fix memleak upon read header failure
The already parsed subtitles (contained in an FFDemuxSubtitlesQueue) would leak if an error happened upon creating an AVStream. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/mpsubdec.c')
-rw-r--r--libavformat/mpsubdec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/mpsubdec.c b/libavformat/mpsubdec.c
index 82c73457ea..e7b83a1d85 100644
--- a/libavformat/mpsubdec.c
+++ b/libavformat/mpsubdec.c
@@ -154,8 +154,10 @@ static int mpsub_read_header(AVFormatContext *s)
}
st = avformat_new_stream(s, NULL);
- if (!st)
- return AVERROR(ENOMEM);
+ if (!st) {
+ res = AVERROR(ENOMEM);
+ goto end;
+ }
avpriv_set_pts_info(st, 64, pts_info.den, pts_info.num);
st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codecpar->codec_id = AV_CODEC_ID_TEXT;