avformat/mov: Fix extradata memleak
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 6 Apr 2018 21:56:57 +0000 (23:56 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 8 Jul 2018 17:45:46 +0000 (19:45 +0200)
Fixes: crbug 822705

Reported-by: Matt Wolenetz <wolenetz@google.com>
Reviewed-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 0a8133119ca5d087c7c7140d100406ff84c477ee)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mov.c

index 8f96fa3..6c47fb0 100644 (file)
@@ -2370,6 +2370,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;