[vlc-commits] skins2: fix file descriptor leak and missing error check

Erwan Tulou git at videolan.org
Fri Jun 12 22:03:11 CEST 2015


vlc/vlc-2.2 | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Jun 11 20:09:10 2015 +0200| [23188e2036b47526e63d6b9346af150957825b10] | committer: Erwan Tulou

skins2: fix file descriptor leak and missing error check

(cherry picked from commit 01bf3662b1af1673cc5f6efbb355a698983a7651)
Signed-off-by: Erwan Tulou <erwan10 at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=23188e2036b47526e63d6b9346af150957825b10
---

 modules/gui/skins2/src/theme_loader.cpp |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp b/modules/gui/skins2/src/theme_loader.cpp
index 5783cda..1fba110 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -115,6 +115,8 @@ bool ThemeLoader::extractTarGz( const string &tarFile, const string &rootDir )
     if( tar_open( &t, (char *)tarFile.c_str(), O_RDONLY ) == -1 )
 #endif
     {
+        msg_Dbg( getIntf(), "failed to open %s as a gzip tar file",
+                            tarFile.c_str() );
         return false;
     }
 
@@ -139,10 +141,18 @@ bool ThemeLoader::extractZip( const string &zipFile, const string &rootDir )
 
     // Try to open the ZIP file
     unzFile file = unzOpen( zipFile.c_str() );
+    if( file == 0 )
+    {
+        msg_Dbg( getIntf(), "failed to open %s as a zip file",
+                 zipFile.c_str() );
+        return false;
+    }
     unz_global_info info;
-
     if( unzGetGlobalInfo( file, &info ) != UNZ_OK )
     {
+        msg_Dbg( getIntf(), "failed to read zip info from %s",
+                 zipFile.c_str() );
+        unzClose( file );
         return false;
     }
     // Extract all the files in the archive
@@ -159,7 +169,7 @@ bool ThemeLoader::extractZip( const string &zipFile, const string &rootDir )
         if( i < info.number_entry - 1 )
         {
             // Go the next file in the archive
-            if( unzGoToNextFile( file ) !=UNZ_OK )
+            if( unzGoToNextFile( file ) != UNZ_OK )
             {
                 msg_Warn( getIntf(), "error while unzipping %s",
                           zipFile.c_str() );



More information about the vlc-commits mailing list