diff options
author | Leigh <leigh@php.net> | 2016-02-08 11:36:14 +0000 |
---|---|---|
committer | Leigh <leigh@php.net> | 2016-02-08 11:36:14 +0000 |
commit | 3ef57f8d5d1ca853aebbc873b6bf18dbdcc197da (patch) | |
tree | 12ce2f9bd40e5a11ccb5b8f35866f95f7fabbb0a | |
parent | 0490d4a4042d248340e5653bfae8d2bdbfb86d15 (diff) | |
download | php-git-3ef57f8d5d1ca853aebbc873b6bf18dbdcc197da.tar.gz |
Fixed memory leak in curl_getinfo()
The "v ? v" in the CAASTR macro caused zend_string_copy to be
called twice
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | ext/curl/interface.c | 5 |
2 files changed, 4 insertions, 2 deletions
@@ -23,6 +23,7 @@ PHP NEWS - CURL: . Fixed bug #71523 (Copied handle with new option CURLOPT_HTTPHEADER crashes while curl_multi_exec). (Laruence) + . Fixed memory leak in curl_getinfo(). (Leigh) - Fileinfo: . Fixed bug #71434 (finfo throws notice for specific python file). (Laruence) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 1cd22a8acf..8b9a756aa2 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -157,7 +157,8 @@ static void _php_curl_close(zend_resource *rsrc); #define CAAL(s, v) add_assoc_long_ex(return_value, s, sizeof(s) - 1, (zend_long) v); #define CAAD(s, v) add_assoc_double_ex(return_value, s, sizeof(s) - 1, (double) v); #define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s) - 1, (char *) (v ? v : "")); -#define CAASTR(s, v) add_assoc_str_ex(return_value, s, sizeof(s) - 1, v ? v : ZSTR_EMPTY_ALLOC()); +#define CAASTR(s, v) add_assoc_str_ex(return_value, s, sizeof(s) - 1, \ + v ? zend_string_copy(v) : ZSTR_EMPTY_ALLOC()); #define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s) -1 , (zval *) v); #if defined(PHP_WIN32) || defined(__GNUC__) @@ -3036,7 +3037,7 @@ PHP_FUNCTION(curl_getinfo) } #endif if (ch->header.str) { - CAASTR("request_header", zend_string_copy(ch->header.str)); + CAASTR("request_header", ch->header.str); } } else { switch (option) { |