[FFmpeg-cvslog] avformat/wtvdec: Fix memleak when reading header fails

Andreas Rheinhardt git at videolan.org
Thu Jul 2 03:32:56 EEST 2020


ffmpeg | branch: release/4.1 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Tue Jan  7 14:55:48 2020 +0100| [e848b20ef0e2106b682f233d527da4cd71d7e6c0] | committer: Andreas Rheinhardt

avformat/wtvdec: Fix memleak when reading header fails

Fixes #8314.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Reviewed-by: Peter Ross <pross at xvid.org>
Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit 373c1c9b691fd4c6831b3a114a006b639304c2af)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e848b20ef0e2106b682f233d527da4cd71d7e6c0
---

 libavformat/wtvdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index b9648c02d6..7971026db6 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -993,8 +993,10 @@ static int read_header(AVFormatContext *s)
     }
 
     ret = parse_chunks(s, SEEK_TO_DATA, 0, 0);
-    if (ret < 0)
+    if (ret < 0) {
+        wtvfile_close(wtv->pb);
         return ret;
+    }
     avio_seek(wtv->pb, -32, SEEK_CUR);
 
     timeline_pos = avio_tell(s->pb); // save before opening another file



More information about the ffmpeg-cvslog mailing list