[FFmpeg-cvslog] avformat/mov: fix memleaks

Zhao Zhili git at videolan.org
Fri Jul 3 03:10:28 EEST 2020


ffmpeg | branch: release/3.4 | Zhao Zhili <quinkblack at foxmail.com> | Sun Jun 28 11:15:39 2020 +0800| [27660619016014ee64aec085608f1c8e79029fac] | committer: Andreas Rheinhardt

avformat/mov: fix memleaks

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 at gmail.com>
(cherry picked from commit f3dc38a186b2326ce03e50969897ea703817ddb0)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=27660619016014ee64aec085608f1c8e79029fac
---

 libavformat/mov.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index c8033edb48..4da44b1bb9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6103,10 +6103,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++) {



More information about the ffmpeg-cvslog mailing list