[vlc-commits] mpeg_audio: use a variable to avoid pointer dereference

Rafaël Carré git at videolan.org
Tue Nov 12 11:55:20 CET 2013


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Tue Nov 12 11:45:21 2013 +0100| [11d3a7ac5686ffdbe5f098264b8677d4aa1e88af] | committer: Rafaël Carré

mpeg_audio: use a variable to avoid pointer dereference

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

 modules/codec/mpeg_audio.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/codec/mpeg_audio.c b/modules/codec/mpeg_audio.c
index 8c300cd..b455849 100644
--- a/modules/codec/mpeg_audio.c
+++ b/modules/codec/mpeg_audio.c
@@ -192,28 +192,30 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 
     if( !pp_block || !*pp_block ) return NULL;
 
-    if( (*pp_block)->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
+    block_t *p_block = *pp_block;
+
+    if( p_block->i_flags&(BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
     {
-        if( (*pp_block)->i_flags&BLOCK_FLAG_CORRUPTED )
+        if( p_block->i_flags&BLOCK_FLAG_CORRUPTED )
         {
             p_sys->i_state = STATE_NOSYNC;
             block_BytestreamEmpty( &p_sys->bytestream );
         }
         date_Set( &p_sys->end_date, 0 );
-        block_Release( *pp_block );
+        block_Release( p_block );
         p_sys->b_discontinuity = true;
         return NULL;
     }
 
-    if( !date_Get( &p_sys->end_date ) && (*pp_block)->i_pts <= VLC_TS_INVALID )
+    if( !date_Get( &p_sys->end_date ) && p_block->i_pts <= VLC_TS_INVALID )
     {
         /* We've just started the stream, wait for the first PTS. */
         msg_Dbg( p_dec, "waiting for PTS" );
-        block_Release( *pp_block );
+        block_Release( p_block );
         return NULL;
     }
 
-    block_BytestreamPush( &p_sys->bytestream, *pp_block );
+    block_BytestreamPush( &p_sys->bytestream, p_block );
 
     while( 1 )
     {



More information about the vlc-commits mailing list