[vlc-devel] [PATCH] avcodec: make sure we don't reuse some free'd pointers

Steve Lhomme robux4 at videolabs.io
Mon Apr 20 17:43:39 CEST 2015


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

diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index 2251cda..b24f34f 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -347,6 +347,7 @@ static void CloseDecoder( vlc_object_t *p_this )
 
     avcodec_free_context( &p_sys->p_context );
     free( p_sys );
+    p_dec->p_sys = NULL;
 }
 
 /*****************************************************************************
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 1790587..c0bda9b 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -815,7 +815,10 @@ void EndVideoDec( decoder_t *p_dec )
         avcodec_free_frame( &p_sys->p_ff_pic );
 
     if( p_sys->p_va )
+    {
         vlc_va_Delete( p_sys->p_va, p_sys->p_context );
+        p_sys->p_va = NULL;
+    }
 
     vlc_sem_destroy( &p_sys->sem_mt );
 }
-- 
2.3.0




More information about the vlc-devel mailing list