]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mlvdec: Don't leak open AVIOContexts on error
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 10 Aug 2020 00:19:35 +0000 (02:19 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 18 Aug 2020 12:25:30 +0000 (14:25 +0200)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/mlvdec.c

index 7c7ced7f76ba4c5c7d9ff5b27ad15f7492b5409a..50913fa685fc4007ec515efc4d9dce7327c635c7 100644 (file)
@@ -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;
     }