]> git.sesse.net Git - vlc/commitdiff
Check asprintf return
authorJean-Baptiste Kempf <jb@videolan.org>
Wed, 16 Dec 2009 10:03:22 +0000 (11:03 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 16 Dec 2009 10:03:22 +0000 (11:03 +0100)
modules/control/http/util.c

index d7d7cb4bf7d0c2777c1afe8a6d3253a75a7deddc..f1d06cf8c218e85ccb8122feb2ea82201c1c46ae 100644 (file)
@@ -953,10 +953,12 @@ char *RealPath( const char *psz_src )
     if( psz_dir[0] == '~' )
     {
         char *home = config_GetUserDir( VLC_HOME_DIR ), *dir;
-        asprintf( &dir, "%s%s", home, psz_dir + 1 );
-        free( psz_dir );
+        if( asprintf( &dir, "%s%s", home, psz_dir + 1 ) != -1 )
+        {
+            free( psz_dir );
+            psz_dir = dir;
+        }
         free( home );
-        psz_dir = dir;
     }
 
     if( strlen(psz_dir) > 2 )