[vlc-devel] commit: mux_asf: fix memleak. ( Rémi Duraffort )

git version control git at videolan.org
Mon May 4 20:13:38 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon May  4 14:44:39 2009 +0200| [6f3cc15c000a11b6c539ee8a77b428fcbec438b4] | committer: Rémi Duraffort 

mux_asf: fix memleak.

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

 modules/mux/asf.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/modules/mux/asf.c b/modules/mux/asf.c
index 6c60bcc..332cae8 100644
--- a/modules/mux/asf.c
+++ b/modules/mux/asf.c
@@ -588,7 +588,10 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             tk->i_extra = 11 + sizeof( BITMAPINFOHEADER ) + i_codec_extra;
             tk->p_extra = malloc( tk->i_extra );
             if( !tk->p_extra )
+            {
+                free( p_codec_extra );
                 return VLC_ENOMEM;
+            }
             bo_init( &bo, tk->p_extra, tk->i_extra );
             bo_addle_u32( &bo, p_input->p_fmt->video.i_width );
             bo_addle_u32( &bo, p_input->p_fmt->video.i_height );
@@ -606,7 +609,10 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
             bo_addle_u32( &bo, 0 );
             bo_addle_u32( &bo, 0 );
             if( i_codec_extra > 0 )
+            {
                 bo_add_mem( &bo, p_codec_extra, i_codec_extra );
+                free( p_codec_extra );
+            }
 
             if( p_input->p_fmt->i_bitrate > 50000 )
             {




More information about the vlc-devel mailing list