Commit: ac3d227e28056bf5294a8a64e2f41ce2beebaa05 Author: Pierrick Charron <pierr...@php.net> Thu, 27 Dec 2012 13:31:55 -0500 Parents: 663434cd764b6030a4d9e6b565e0fff9eaa6a66c Branches: PHP-5.4 PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ac3d227e28056bf5294a8a64e2f41ce2beebaa05 Log: Fixed #63859 Memory leak when reusing curl-handle When CURLOPT_POSTFIELDS is called more than once on the same curl handle, php/curl did not free the memory of the previous post data. This commit will fix the problem unless the curl handle was previously duplicated using the curl_copy_handle() function in which case we can not know if the post data is still in use or not by any curl handle Bugs: https://bugs.php.net/63859 Changed paths: M NEWS M ext/curl/interface.c Diff: diff --git a/NEWS b/NEWS index 208af93..164daeb 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ PHP NEWS - cURL extension: . Fixed bug (segfault due to libcurl connection caching). (Pierrick) + . Fixed bug #63859 (Memory leak when reusing curl-handle). (Pierrick) . Fixed bug #63795 (CURL >= 7.28.0 no longer support value 1 for CURLOPT_SSL_VERIFYHOST). (Pierrick) . Fixed bug #63352 (Can't enable hostname validation when using curl stream diff --git a/ext/curl/interface.c b/ext/curl/interface.c index a23f859..55102da 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2131,6 +2131,9 @@ string_copy: return 1; } + if (Z_REFCOUNT_P(ch->clone) <= 1) { + zend_llist_clean(&ch->to_free->post); + } zend_llist_add_element(&ch->to_free->post, &first); error = curl_easy_setopt(ch->cp, CURLOPT_HTTPPOST, first); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php