From: Michael Wallner Date: Wed, 19 Apr 2006 11:04:18 +0000 (+0000) Subject: - erm, complete the fix X-Git-Tag: RELEASE_1_0_0~44 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=e617c45f50c2233376a2cac393da1f0d03965a5c;p=m6w6%2Fext-http - erm, complete the fix --- diff --git a/http_functions.c b/http_functions.c index 550ce8f..113db97 100644 --- a/http_functions.c +++ b/http_functions.c @@ -180,7 +180,9 @@ PHP_FUNCTION(http_build_url) if (new_url) { php_url_free(new_url); } - php_url_free(old_url); + if (old_url) { + php_url_free(old_url); + } RETURN_STRINGL(url_str, url_len, 0); } diff --git a/http_url_api.c b/http_url_api.c index cb1b82f..bdda911 100644 --- a/http_url_api.c +++ b/http_url_api.c @@ -72,15 +72,16 @@ PHP_HTTP_API char *_http_absolute_url(const char *url TSRMLS_DC) if (url) { purl = php_url_parse(abs = estrdup(url)); STR_SET(abs, NULL); - } else { - purl = ecalloc(1, sizeof(php_url)); + if (!purl) { + http_error_ex(HE_WARNING, HTTP_E_URL, "Could not parse URL (%s)", url); + return NULL; + } } + http_build_url(0, purl, NULL, NULL, &abs, NULL); + if (purl) { - http_build_url(0, purl, NULL, NULL, &abs, NULL); php_url_free(purl); - } else { - http_error_ex(HE_WARNING, HTTP_E_URL, "Could not parse URL (%s)", url); } return abs;