From 1e768865dce01e401e479f415900e782892cd23d Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 13 Jul 2007 09:14:03 +0000 Subject: [PATCH] Fixed memleak --- ext/soap/php_http.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index e59934dd780..c816d217889 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -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: ");