diff mbox series

[FFmpeg-devel] avformat/mov: fix memleaks

Message ID 20200628031600.C6EA768B75A@ffbox0-bg.mplayerhq.hu
State Accepted
Headers show
Series [FFmpeg-devel] avformat/mov: fix memleaks
Related show

Checks

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

Commit Message

Zhao Zhili June 28, 2020, 3:15 a.m. UTC
From: Zhao Zhili <quinkblack@foxmail.com>

Fix two cases of memleaks:
1. The leak of dv_demux
2. The leak of dv_fctx upon dv_demux allocate failure
---
 libavformat/mov.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index adc52de947..f179b6efdd 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -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++) {