aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-08-10 02:19:35 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-27 07:20:56 +0100
commit45c83744fd3b813730be6f9c09341be77e7518ce (patch)
tree47d10ca6c8339ca1bd8a7a6a8cf1a1b139980e18
parent280c6e0d1cf7c22c6f9f551edbc7942b96df93c6 (diff)
downloadffmpeg-45c83744fd3b813730be6f9c09341be77e7518ce.tar.gz
avformat/mlvdec: Don't leak open AVIOContexts on error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> (cherry picked from commit 0d560873da2fc851955e95957473026d2d2243cc)
-rw-r--r--libavformat/mlvdec.c3
1 files changed, 3 insertions, 0 deletions
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;
}