]> git.sesse.net Git - vlc/commitdiff
Avoid memleak and use of uninitiliazed pointer
authorChristophe Mutricy <xtophe@videolan.org>
Sat, 29 Mar 2008 00:06:11 +0000 (00:06 +0000)
committerChristophe Mutricy <xtophe@videolan.org>
Sat, 29 Mar 2008 00:07:10 +0000 (00:07 +0000)
modules/stream_out/standard.c

index 041ce0d28b5063f7aac18f48fcebbd2743315bd2..c318f018a31087a41159cba48cb33bf7ae1885bd 100644 (file)
@@ -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;