com php-src: Fixed memory leak in curl_getinfo(): NEW S ext/curl/interface.c

From: Date: Mon, 08 Feb 2016 11:36:14 +0000
Subject: com php-src: Fixed memory leak in curl_getinfo(): NEW S ext/curl/interface.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90965@lists.php.net to get a copy of this message
Commit: 3ef57f8d5d1ca853aebbc873b6bf18dbdcc197da Author: Leigh <leigh@php.net> Mon, 8 Feb 2016 11:36:14 +0000 Parents: 0490d4a4042d248340e5653bfae8d2bdbfb86d15 Branches: PHP-7.0 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3ef57f8d5d1ca853aebbc873b6bf18dbdcc197da Log: Fixed memory leak in curl_getinfo() The "v ? v" in the CAASTR macro caused zend_string_copy to be called twice Changed paths: M NEWS M ext/curl/interface.c Diff: diff --git a/NEWS b/NEWS index 1a18dbe..6390d60 100644 --- a/NEWS +++ b/NEWS @@ -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 1cd22a8..8b9a756 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) {

« previous php.cvs (#90965) next »