1
0
mirror of https://github.com/php/php-src.git synced 2026-03-29 11:42:17 +02:00

Fixed memory leak in curl_getinfo()

The "v ? v" in the CAASTR macro caused zend_string_copy to be
called twice
This commit is contained in:
Leigh
2016-02-08 11:36:14 +00:00
parent 0490d4a404
commit 3ef57f8d5d
2 changed files with 4 additions and 2 deletions

1
NEWS
View File

@@ -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)

View File

@@ -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) {