[vlc-commits] avcodec: fix double free

Rémi Denis-Courmont git at videolan.org
Thu Oct 2 20:44:35 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct  2 21:41:40 2014 +0300| [b3003a5ae34d23e5e5efcb1154f08b9f99743fc8] | committer: Rémi Denis-Courmont

avcodec: fix double free

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b3003a5ae34d23e5e5efcb1154f08b9f99743fc8
---

 modules/codec/avcodec/avcodec.c         |    1 -
 modules/codec/avcodec/avcommon_compat.h |    4 +++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index 59be081..232134a 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -341,7 +341,6 @@ static void CloseDecoder( vlc_object_t *p_this )
 
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    av_free( p_sys->p_context->extradata );
     avcodec_free_context( &p_sys->p_context );
     free( p_sys );
 }
diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
index fb2396f..6ae0967 100644
--- a/modules/codec/avcodec/avcommon_compat.h
+++ b/modules/codec/avcodec/avcommon_compat.h
@@ -42,7 +42,9 @@
 
 static inline void avcodec_free_context( AVCodecContext **ctx )
 {
-    av_freep( ctx );
+    av_free( ctx->extradata );
+    av_free( ctx );
+    *ctx = NULL;
 }
 #endif
 



More information about the vlc-commits mailing list