[vlc-commits] speek: fix potential NULL dereference

Rémi Denis-Courmont git at videolan.org
Mon Aug 18 20:06:15 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 18 21:06:04 2014 +0300| [5dae442d8112968fc6ecb54b140d547f09ec05cd] | committer: Rémi Denis-Courmont

speek: fix potential NULL dereference

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

 modules/codec/speex.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/codec/speex.c b/modules/codec/speex.c
index cbfb84a..c93fbc6 100644
--- a/modules/codec/speex.c
+++ b/modules/codec/speex.c
@@ -335,11 +335,13 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 
     if( !pp_block ) return NULL;
 
-    if( *pp_block )
+    block_t *block = *pp_block;
+
+    if( block != NULL )
     {
         /* Block to Ogg packet */
-        oggpacket.packet = (*pp_block)->p_buffer;
-        oggpacket.bytes = (*pp_block)->i_buffer;
+        oggpacket.packet = block->p_buffer;
+        oggpacket.bytes = block->i_buffer;
     }
     else
     {
@@ -364,13 +366,15 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 
             if( CreateDefaultHeader( p_dec ) )
             {
-                block_Release( *pp_block );
+                if( block != NULL )
+                    block_Release( block );
                 return NULL;
             }
         }
         else if( ProcessHeaders( p_dec ) )
         {
-            block_Release( *pp_block );
+            if( block != NULL )
+                block_Release( block );
             return NULL;
         }
         p_sys->b_has_headers = true;



More information about the vlc-commits mailing list