[vlc-commits] avcodec: fix invalid free

Thomas Guillem git at videolan.org
Tue Dec 8 17:15:37 CET 2015


vlc/vlc-2.2 | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jul 30 17:37:34 2015 +0200| [07ddb88cd7e7b8642e53b95aeee8b18077dd44cf] | committer: Thomas Guillem

avcodec: fix invalid free

Initialize frame to NULL before goto end

(cherry picked from commit 3fc28a0bc620ea3668181eb24ddb0b5f0d00e869)

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

 modules/codec/avcodec/audio.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index ae2f9dd..9dc8928 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -265,6 +265,7 @@ block_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     AVCodecContext *ctx = p_sys->p_context;
+    AVFrame *frame = NULL;
 
     if( !pp_block || !*pp_block )
         return NULL;
@@ -312,11 +313,11 @@ block_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
     }
 
 #if (LIBAVCODEC_VERSION_MAJOR >= 55)
-    AVFrame *frame = av_frame_alloc();
+    frame = av_frame_alloc();
     if (unlikely(frame == NULL))
         goto end;
 #else
-    AVFrame *frame = &(AVFrame) { };
+    frame = &(AVFrame) { };
 #endif
 
     for( int got_frame = 0; !got_frame; )



More information about the vlc-commits mailing list