]> git.sesse.net Git - vlc/commitdiff
Fixed sanetizing of file name in input_CreateFilename.
authorLaurent Aimar <fenrir@videolan.org>
Wed, 8 Apr 2009 19:51:00 +0000 (21:51 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 8 Apr 2009 20:36:02 +0000 (22:36 +0200)
It should fix #2620 (and was not limited to windows only).

src/input/input.c

index 585694448dd056d1a3015765a9f3aa2a55b3747d..dfb27e59ff15f2224f5f26c965676300028f57f6 100644 (file)
@@ -3253,13 +3253,16 @@ char *input_CreateFilename( vlc_object_t *p_obj, const char *psz_path, const cha
         if( !psz_tmp )
             return NULL;
 
-        filename_sanitize( psz_tmp );
-        if( asprintf( &psz_file, "%s"DIR_SEP"%s%s%s",
-                      psz_path, psz_tmp,
+        char *psz_tmp2 = filename_sanitize( psz_tmp );
+        free( psz_tmp );
+
+        if( !psz_tmp2 ||
+            asprintf( &psz_file, "%s"DIR_SEP"%s%s%s",
+                      psz_path, psz_tmp2,
                       psz_extension ? "." : "",
                       psz_extension ? psz_extension : "" ) < 0 )
             psz_file = NULL;
-        free( psz_tmp );
+        free( psz_tmp2 );
         return psz_file;
     }
     else