[vlc-devel] commit: zipaccess: correct memory leak (probing work moved before calloc) ( Erwan Tulou )

git version control git at videolan.org
Thu Jul 23 23:31:20 CEST 2009


vlc | branch: 1.0-bugfix | Erwan Tulou <erwan10 at videolan.org> | Tue Jul 21 13:32:42 2009 +0200| [0bc96b8b721f1d8f8f321ed51fe3540f0e9ad2b3] | committer: Erwan Tulou 

zipaccess: correct memory leak (probing work moved before calloc)
(cherry picked from commit 7b7421e9b70b52d8ede9d4dc6778b2621d411851)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0bc96b8b721f1d8f8f321ed51fe3540f0e9ad2b3
---

 modules/access/zip/zipaccess.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/modules/access/zip/zipaccess.c b/modules/access/zip/zipaccess.c
index 6f04d91..63dcd22 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 );




More information about the vlc-devel mailing list