From 7b7421e9b70b52d8ede9d4dc6778b2621d411851 Mon Sep 17 00:00:00 2001 From: Erwan Tulou Date: Tue, 21 Jul 2009 13:32:42 +0200 Subject: [PATCH] zipaccess: correct memory leak (probing work moved before calloc) --- modules/access/zip/zipaccess.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/access/zip/zipaccess.c b/modules/access/zip/zipaccess.c index 6f04d919df..63dcd22e43 100644 --- a/modules/access/zip/zipaccess.c +++ b/modules/access/zip/zipaccess.c @@ -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 ); -- 2.39.2