- erm, complete the fix
authorMichael Wallner <mike@php.net>
Wed, 19 Apr 2006 11:04:18 +0000 (11:04 +0000)
committerMichael Wallner <mike@php.net>
Wed, 19 Apr 2006 11:04:18 +0000 (11:04 +0000)
http_functions.c
http_url_api.c

index 550ce8ff7934169059a07e28a842c63f4a094525..113db97628f68627477f6893e393d01039facdf1 100644 (file)
@@ -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);
 }
index cb1b82f89363cdc7beb89668d784a916598d87a6..bdda91161088340f01a72cf38738f41eae50d5db 100644 (file)
@@ -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;