cellog          Sun May 18 23:11:24 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/phar   phar_object.c 
  Log:
  fix segfault, test coming shortly
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_object.c?r1=1.266.2.4&r2=1.266.2.5&diff_format=u
Index: php-src/ext/phar/phar_object.c
diff -u php-src/ext/phar/phar_object.c:1.266.2.4 
php-src/ext/phar/phar_object.c:1.266.2.5
--- php-src/ext/phar/phar_object.c:1.266.2.4    Sat May 17 20:07:22 2008
+++ php-src/ext/phar/phar_object.c      Sun May 18 23:11:24 2008
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: phar_object.c,v 1.266.2.4 2008/05/17 20:07:22 cellog Exp $ */
+/* $Id: phar_object.c,v 1.266.2.5 2008/05/18 23:11:24 cellog Exp $ */
 
 #include "phar_internal.h"
 #include "func_interceptors.h"
@@ -445,7 +445,7 @@
  */
 PHP_METHOD(Phar, mount)
 {
-       char *fname, *arch, *entry, *path, *actual;
+       char *fname, *arch = NULL, *entry = NULL, *path, *actual;
        int fname_len, arch_len, entry_len, path_len, actual_len;
        phar_archive_data **pphar;
 
@@ -467,7 +467,9 @@
 carry_on2:
                if (SUCCESS != zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), 
arch, arch_len, (void **)&pphar)) {
                        zend_throw_exception_ex(phar_ce_PharException, 0 
TSRMLS_CC, "%s is not a phar archive, cannot mount", arch);
-                       efree(arch);
+                       if (arch) {
+                               efree(arch);
+                       }
                        return;
                }
 carry_on:
@@ -476,13 +478,17 @@
                        if (path && path == entry) {
                                efree(entry);
                        }
-                       efree(arch);
+                       if (arch) {
+                               efree(arch);
+                       }
                        return;
                }
-               if (path && path == entry) {
+               if (entry && path && path == entry) {
                        efree(entry);
                }
-               efree(arch);
+               if (arch) {
+                       efree(arch);
+               }
                return;
        } else if (SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), 
fname, fname_len, (void **)&pphar)) {
                goto carry_on;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to