]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mov: fix memleaks
authorZhao Zhili <quinkblack@foxmail.com>
Sun, 28 Jun 2020 03:15:39 +0000 (11:15 +0800)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 1 Jul 2020 13:28:03 +0000 (15:28 +0200)
Fix two cases of memleaks:
1. The leak of dv_demux
2. The leak of dv_fctx upon dv_demux allocate failure

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/mov.c

index 8be01dd66b9efc9d1e49d48a480d6dc91a862076..df5bebdff186bf066b9ea582fd78a89df8045b6b 100644 (file)
@@ -7357,10 +7357,9 @@ static int mov_read_close(AVFormatContext *s)
         av_freep(&sc->coll);
     }
 
-    if (mov->dv_demux) {
-        avformat_free_context(mov->dv_fctx);
-        mov->dv_fctx = NULL;
-    }
+    av_freep(&mov->dv_demux);
+    avformat_free_context(mov->dv_fctx);
+    mov->dv_fctx = NULL;
 
     if (mov->meta_keys) {
         for (i = 1; i < mov->meta_keys_count; i++) {