[FFmpeg-devel] [PATCH 1/2] avformat/mov: Fix extradata memleak

Michael Niedermayer michael at niedermayer.cc
Tue Apr 10 03:28:19 EEST 2018


Fixes: crbug 822705

Reported-by: Matt Wolenetz <wolenetz at google.com>
Reviewed-by: Matt Wolenetz <wolenetz at google.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/mov.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 97b1462aab..1340bf3913 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2592,6 +2592,12 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     return mov_finalize_stsd_codec(c, pb, st, sc);
 fail:
+    if (sc->extradata) {
+        int j;
+        for (j = 0; j < sc->stsd_count; j++)
+            av_freep(&sc->extradata[j]);
+    }
+
     av_freep(&sc->extradata);
     av_freep(&sc->extradata_size);
     return ret;
-- 
2.17.0



More information about the ffmpeg-devel mailing list