[FFmpeg-cvslog] avformat/mov: fix memleaks

Zhao Zhili git at videolan.org
Wed Jul 1 17:44:23 EEST 2020


ffmpeg | branch: release/2.8 | Zhao Zhili <quinkblack at foxmail.com> | Sun Jun 28 11:15:39 2020 +0800| [7db4f36291464ba81c75accd99c0279e6892463a] | 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=7db4f36291464ba81c75accd99c0279e6892463a
---

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 60538d4f66..cc56c8792a 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4372,10 +4372,9 @@ static int mov_read_close(AVFormatContext *s)
         av_freep(&sc->display_matrix);
     }
 
-    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;
 
     av_freep(&mov->trex_data);
     av_freep(&mov->bitrates);



More information about the ffmpeg-cvslog mailing list