From 33be4451ab1e395c433395e8bc6014453d36827a Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 9 Feb 2015 10:48:58 +0100 Subject: [PATCH] fix leaks dues to upmerges --- php_http_client_curl.c | 17 ++++++++++++++++- php_http_message.c | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/php_http_client_curl.c b/php_http_client_curl.c index 0463143..69d01a7 100644 --- a/php_http_client_curl.c +++ b/php_http_client_curl.c @@ -1111,11 +1111,14 @@ static ZEND_RESULT_CODE php_http_curle_option_set_proxyheader(php_http_option_t { if (header_key.key) { zend_string *zs = zval_get_string(header_val); + php_http_buffer_appendf(&header, "%s: %s", header_key.key->val, zs->val); + zend_string_release(zs); + php_http_buffer_fix(&header); curl->options.proxyheaders = curl_slist_append(curl->options.proxyheaders, header.data); php_http_buffer_reset(&header); - zend_string_release(zs); + } } ZEND_HASH_FOREACH_END(); @@ -1834,11 +1837,23 @@ static void php_http_client_curl_handler_dtor(php_http_client_curl_handler_t *ha php_http_buffer_dtor(&handler->options.cookies); zend_hash_destroy(&handler->options.cache); +#if PHP_HTTP_CURL_VERSION(7,21,3) + if (handler->options.resolve) { + curl_slist_free_all(handler->options.resolve); + handler->options.resolve = NULL; + } +#endif + if (handler->options.headers) { curl_slist_free_all(handler->options.headers); handler->options.headers = NULL; } + if (handler->options.proxyheaders) { + curl_slist_free_all(handler->options.proxyheaders); + handler->options.proxyheaders = NULL; + } + efree(handler); } diff --git a/php_http_message.c b/php_http_message.c index ae7ca6e..6ecf6e7 100644 --- a/php_http_message.c +++ b/php_http_message.c @@ -1106,7 +1106,7 @@ static PHP_METHOD(HttpMessage, getHeader) if ((header = php_http_message_header(obj->message, header_str, header_len))) { if (!header_ce) { - RETURN_ZVAL(header, 1, 1); + RETURN_ZVAL_FAST(header); } else if (instanceof_function(header_ce, php_http_header_class_entry)) { php_http_object_method_t cb; zval argv[2]; -- 2.30.2