[vlc-commits] adpcm: fix decoding and gapping memory leak (fixes #16953)

Rémi Denis-Courmont git at videolan.org
Sat May 14 18:21:32 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat May 14 19:18:43 2016 +0300| [4ff2515cbcae59af3e0791e704899f3990fe10ac] | committer: Rémi Denis-Courmont

adpcm: fix decoding and gapping memory leak (fixes #16953)

On the bright side, the regression was easy to find by just looking at
the list of recent and finding the name of the M2X developer there
(true story).

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

 modules/codec/adpcm.c |   18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/modules/codec/adpcm.c b/modules/codec/adpcm.c
index 2c74185..41321fe 100644
--- a/modules/codec/adpcm.c
+++ b/modules/codec/adpcm.c
@@ -288,13 +288,9 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     if( !pp_block || !*pp_block ) return NULL;
 
     p_block = *pp_block;
-    *pp_block = NULL; /* So the packet doesn't get re-sent */
 
     if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
-    {
-        block_Release( p_block );
-        return NULL;
-    }
+        goto drop;
 
     if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY )
         Flush( p_dec );
@@ -305,11 +301,8 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         date_Set( &p_sys->end_date, p_block->i_pts );
     }
     else if( !date_Get( &p_sys->end_date ) )
-    {
         /* We've just started the stream, wait for the first PTS. */
-        block_Release( p_block );
-        return NULL;
-    }
+        goto drop;
 
     /* Don't re-use the same pts twice */
     p_block->i_pts = VLC_TS_INVALID;
@@ -320,10 +313,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 
         p_out = decoder_NewAudioBuffer( p_dec, p_sys->i_samplesperblock );
         if( p_out == NULL )
-        {
-            block_Release( p_block );
-            return NULL;
-        }
+            goto drop;
 
         p_out->i_pts = date_Get( &p_sys->end_date );
         p_out->i_length = date_Increment( &p_sys->end_date,
@@ -363,7 +353,9 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         return p_out;
     }
 
+drop:
     block_Release( p_block );
+    *pp_block = NULL;
     return NULL;
 }
 



More information about the vlc-commits mailing list