[FFmpeg-cvslog] avformat/mlvdec: Don't leak open AVIOContexts on error

Andreas Rheinhardt git at videolan.org
Tue Aug 18 15:36:47 EEST 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Mon Aug 10 02:19:35 2020 +0200| [0d560873da2fc851955e95957473026d2d2243cc] | committer: Andreas Rheinhardt

avformat/mlvdec: Don't leak open AVIOContexts on error

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

 libavformat/mlvdec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
index 7c7ced7f76..50913fa685 100644
--- a/libavformat/mlvdec.c
+++ b/libavformat/mlvdec.c
@@ -52,6 +52,8 @@ typedef struct {
     uint64_t pts;
 } MlvContext;
 
+static int read_close(AVFormatContext *s);
+
 static int probe(const AVProbeData *p)
 {
     if (AV_RL32(p->buf) == MKTAG('M','L','V','I') &&
@@ -376,6 +378,7 @@ static int read_header(AVFormatContext *avctx)
 
     if ((vst && !vst->nb_index_entries) || (ast && !ast->nb_index_entries)) {
         av_log(avctx, AV_LOG_ERROR, "no index entries found\n");
+        read_close(avctx);
         return AVERROR_INVALIDDATA;
     }
 



More information about the ffmpeg-cvslog mailing list