From e617c45f50c2233376a2cac393da1f0d03965a5c Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 19 Apr 2006 11:04:18 +0000 Subject: [PATCH] - erm, complete the fix --- http_functions.c | 4 +++- http_url_api.c | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) 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; -- 2.30.2