diff mbox series

[FFmpeg-devel,2/3] avformat/mlvdec: Don't leak open AVIOContexts on error

Message ID 20200810011023.17540-2-andreas.rheinhardt@gmail.com
State Accepted
Commit 0d560873da2fc851955e95957473026d2d2243cc
Headers show
Series [FFmpeg-devel,1/3] avformat/mlvdec: Check for existence of AVIOContext before using it | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 10, 2020, 1:10 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/mlvdec.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Paul B Mahol Aug. 19, 2020, 7:13 p.m. UTC | #1
On 8/10/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/mlvdec.c | 3 +++
>  1 file changed, 3 insertions(+)
>

Probably OK
diff mbox series

Patch

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;
     }