[vlc-commits] codec: lpcm: fix leak on error

Francois Cartegnie git at videolan.org
Fri Mar 10 15:16:21 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Mar 10 14:41:15 2017 +0100| [7aeaeaa4b7ff754137a56088f5d7bcc38a4d598c] | committer: Francois Cartegnie

codec: lpcm: fix leak on error

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

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

diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c
index a3df204..473a86d 100644
--- a/modules/codec/lpcm.c
+++ b/modules/codec/lpcm.c
@@ -458,11 +458,12 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
 
         /* */
         block_t *p_aout_buffer;
-        if( decoder_UpdateAudioFormat( p_dec ) )
-            return NULL;
-        p_aout_buffer = decoder_NewAudioBuffer( p_dec, i_frame_length );
-        if( !p_aout_buffer )
+        if( decoder_UpdateAudioFormat( p_dec ) != VLC_SUCCESS ||
+           !(p_aout_buffer = decoder_NewAudioBuffer( p_dec, i_frame_length )) )
+        {
+            block_Release( p_block );
             return NULL;
+        }
 
         p_aout_buffer->i_pts = date_Get( &p_sys->end_date );
         p_aout_buffer->i_length =



More information about the vlc-commits mailing list