diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-06-14 03:20:09 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-07-03 14:13:46 +0200 |
commit | c253f384dc1b831836091c72bf68e26906424be2 (patch) | |
tree | 88007bc4944d398564f001f996856b51503bcc67 | |
parent | ed1f68ccfe9b543104a0bf605578bdb6123ae41e (diff) | |
download | ffmpeg-c253f384dc1b831836091c72bf68e26906424be2.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>
(cherry picked from commit a5ed8aeea4f4199e89520c3fdbd9d07ae7fc3c3f)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r-- | libavformat/mpsubdec.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/mpsubdec.c b/libavformat/mpsubdec.c index 1236efa712..8b9016876f 100644 --- a/libavformat/mpsubdec.c +++ b/libavformat/mpsubdec.c @@ -97,8 +97,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; |