[FFmpeg-devel] [PATCH 10/11] avformat/wtvdec: Fix memleak when reading header fails

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Tue Jan 7 15:55:48 EET 2020


Fixes #8314.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavformat/wtvdec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index 706e8ca38d..92629bb31b 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
-- 
2.20.1



More information about the ffmpeg-devel mailing list