]> granicus.if.org Git - php/commitdiff
- Fix invalid efree() call
authorMarcus Boerger <helly@php.net>
Mon, 28 May 2007 21:04:42 +0000 (21:04 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 28 May 2007 21:04:42 +0000 (21:04 +0000)
ext/phar/phar.c

index 461b4b98774d74e1b3171737302a01a3663218b5..36af2057c0db6cca956a325f075011774d0b402d 100644 (file)
@@ -1421,7 +1421,7 @@ int phar_split_fname(char *filename, int filename_len, char **arch, int *arch_le
 static php_url* phar_open_url(php_stream_wrapper *wrapper, char *filename, char *mode, int options TSRMLS_DC) /* {{{ */
 {
        php_url *resource;
-       char *arch, *entry, *error;
+       char *arch, *entry = NULL, *error;
        int arch_len, entry_len;
 
        if (!strncasecmp(filename, "phar://", 7)) {
@@ -1432,7 +1432,9 @@ static php_url* phar_open_url(php_stream_wrapper *wrapper, char *filename, char
                if (phar_split_fname(filename, strlen(filename), &arch, &arch_len, &entry, &entry_len TSRMLS_CC) == FAILURE) {
                        php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: invalid url \"%s\" (cannot contain .phar.php and .phar.gz/.phar.bz2)", filename);
                        efree(arch);
-                       efree(entry);
+                       if (entry) {
+                               efree(entry);
+                       }
                        return NULL;
                }
                resource = ecalloc(1, sizeof(php_url));