[vlc-devel] commit: Avoid memleak and use of uninitiliazed pointer (Christophe Mutricy )

git version control git at videolan.org
Sat Mar 29 01:07:56 CET 2008


vlc | branch: master | Christophe Mutricy <xtophe at videolan.org> | Sat Mar 29 00:06:11 2008 +0000| [4e976a6e0f356e0c1ce576461bb54f65dd42392f]

Avoid memleak and use of uninitiliazed pointer

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

 modules/stream_out/standard.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/stream_out/standard.c b/modules/stream_out/standard.c
index 041ce0d..c318f01 100644
--- a/modules/stream_out/standard.c
+++ b/modules/stream_out/standard.c
@@ -164,7 +164,7 @@ static int Open( vlc_object_t *p_this )
 
     char *psz_mux;
     char *psz_access;
-    char *psz_url;
+    char *psz_url=NULL;
     char *psz_bind;
     char *psz_path;
 
@@ -203,8 +203,13 @@ static int Open( vlc_object_t *p_this )
     }
 
     var_Get( p_stream, SOUT_CFG_PREFIX "dst", &val );
-    if( *val.psz_string ) psz_url = val.psz_string;
-    if( !*val.psz_string ) free( val.psz_string );
+    if( *val.psz_string ) 
+    {
+        free( psz_url);
+        psz_url = val.psz_string;
+    }
+    else
+        free( val.psz_string );
 
     p_sys = p_stream->p_sys = malloc( sizeof( sout_stream_sys_t) );
     if( !p_sys ) return VLC_ENOMEM;




More information about the vlc-devel mailing list