From: Marcus Boerger Date: Tue, 3 Jan 2006 16:22:23 +0000 (+0000) Subject: - Fix two crashes in case of error X-Git-Tag: RELEASE_1_0_4~144 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cc860105fe625a420ae47f80f068c32fc5e49440;p=php - Fix two crashes in case of error --- diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 3f44e0bacf..7b9780bb77 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -1002,12 +1002,14 @@ PHP_PHAR_API php_stream *phar_opendir(php_stream_wrapper *wrapper, char *filenam resource = php_url_parse(filename); /* we must have at the very least phar://alias.phar/ */ if (!resource || !resource->scheme || !resource->host || !resource->path) { - if (resource->host && !resource->path) { + if (resource && resource->host && !resource->path) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: no directory in \"%s\", must have at least phar://%s/ for root directory", filename, resource->host); php_url_free(resource); return NULL; } - php_url_free(resource); + if (resource) { + php_url_free(resource); + } php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "phar error: invalid url \"%s\", must have at least phar://%s/", filename, filename); return NULL; }