]> git.sesse.net Git - vlc/commitdiff
zipaccess: correct memory leak (probing work moved before calloc)
authorErwan Tulou <erwan10@videolan.org>
Tue, 21 Jul 2009 11:32:42 +0000 (13:32 +0200)
committerErwan Tulou <erwan10@videolan.org>
Thu, 23 Jul 2009 21:17:02 +0000 (23:17 +0200)
modules/access/zip/zipaccess.c

index 6f04d919df52c4cd0d11578328def27cbc86183b..63dcd22e43f69d602d98934893aac8b7dde1aa96 100644 (file)
@@ -105,6 +105,12 @@ int AccessOpen( vlc_object_t *p_this )
 
     char *psz_pathToZip = NULL, *psz_path = NULL, *psz_sep = NULL;
 
+    if( !strstr( p_access->psz_path, ZIP_SEP ) )
+    {
+        msg_Dbg( p_access, "path does not contain separator " ZIP_SEP );
+        return VLC_EGENERIC;
+    }
+
     p_access->p_sys = p_sys = (access_sys_t*)
             calloc( 1, sizeof( access_sys_t ) );
     if( !p_sys )
@@ -113,11 +119,6 @@ int AccessOpen( vlc_object_t *p_this )
     /* Split the MRL */
     psz_path = strdup( p_access->psz_path );
     psz_sep = strstr( psz_path, ZIP_SEP );
-    if( !psz_sep )
-    {
-        msg_Dbg( p_access, "path does not contain separator " ZIP_SEP );
-        return VLC_EGENERIC;
-    }
 
     *psz_sep = '\0';
     psz_pathToZip = unescapeXml( psz_path );