]> granicus.if.org Git - php/commitdiff
Fixed memleak
authorDmitry Stogov <dmitry@php.net>
Fri, 13 Jul 2007 09:14:03 +0000 (09:14 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 13 Jul 2007 09:14:03 +0000 (09:14 +0000)
ext/soap/php_http.c

index e59934dd78063aba22f5d6fbaee3587820a7aac5..c816d217889fa71c9a99edd870738a2a411258b6 100644 (file)
@@ -288,6 +288,7 @@ int make_http_soap_request(zval  *this_ptr,
                                request_size = Z_STRLEN(retval);
                        } else {
                                if (request != buf) {efree(request);}
+                               smart_str_free(&soap_headers_z);
                                return FALSE;
                        }
          }
@@ -311,6 +312,7 @@ try_again:
          if (phpurl != NULL) {php_url_free(phpurl);}
                if (request != buf) {efree(request);}
                add_soap_fault(this_ptr, "HTTP", "Unable to parse URL", NULL, NULL TSRMLS_CC);
+               smart_str_free(&soap_headers_z);
                return FALSE;
        }
 
@@ -321,6 +323,7 @@ try_again:
                php_url_free(phpurl);
                if (request != buf) {efree(request);}
                add_soap_fault(this_ptr, "HTTP", "Unknown protocol. Only http and https are allowed.", NULL, NULL TSRMLS_CC);
+               smart_str_free(&soap_headers_z);
                return FALSE;
        }
 
@@ -331,6 +334,7 @@ try_again:
                if (request != buf) {efree(request);}
                add_soap_fault(this_ptr, "HTTP", "SSL support is not available in this build", NULL, NULL TSRMLS_CC);
                PG(allow_url_fopen) = old_allow_url_fopen;
+               smart_str_free(&soap_headers_z);
                return FALSE;
        }
 
@@ -380,6 +384,7 @@ try_again:
                        if (request != buf) {efree(request);}
                        add_soap_fault(this_ptr, "HTTP", "Could not connect to host", NULL, NULL TSRMLS_CC);
                        PG(allow_url_fopen) = old_allow_url_fopen;
+                       smart_str_free(&soap_headers_z);
                        return FALSE;
                }
        }
@@ -438,7 +443,6 @@ try_again:
                }
 
                smart_str_append(&soap_headers, &soap_headers_z);
-               smart_str_free(&soap_headers_z);
 
                if (soap_version == SOAP_1_2) {
                        smart_str_append_const(&soap_headers,"Content-Type: application/soap+xml; charset=utf-8");
@@ -695,6 +699,7 @@ try_again:
 
        } else {
                add_soap_fault(this_ptr, "HTTP", "Failed to create stream??", NULL, NULL TSRMLS_CC);
+               smart_str_free(&soap_headers_z);
                return FALSE;
        }
 
@@ -702,6 +707,7 @@ try_again:
                php_stream_close(stream);
                zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
                zend_hash_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy"));
+               smart_str_free(&soap_headers_z);
                return TRUE;
        }
 
@@ -713,6 +719,7 @@ try_again:
                        zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
                        zend_hash_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy"));
                        add_soap_fault(this_ptr, "HTTP", "Error Fetching http headers", NULL, NULL TSRMLS_CC);
+                       smart_str_free(&soap_headers_z);
                        return FALSE;
                }
 
@@ -861,6 +868,7 @@ try_again:
                if (http_msg) {
                        efree(http_msg);
                }
+               smart_str_free(&soap_headers_z);
                return FALSE;
        }
 
@@ -1008,6 +1016,7 @@ try_again:
                }
                if (auth) efree(auth);
        }
+       smart_str_free(&soap_headers_z);
 
        /* Check and see if the server even sent a xml document */
        content_type = get_http_header_value(http_headers,"Content-Type: ");