`curl_copy_handle()` already registers a new resource, so we must not
increase the refcount of the original resource.
. Fixed bug #79364 (When copy empty array, next key is unspecified). (cmb)
. Fixed bug #78210 (Invalid pointer address). (cmb, Nikita)
+- CURL:
+ . Fixed bug #79199 (curl_copy_handle() memory leak). (cmb)
+
- SimpleXML:
. Fixed bug #61597 (SXE properties may lack attributes and content). (cmb)
_php_setup_easy_copy_handlers(dupch, ch);
- Z_ADDREF_P(zid);
-
ZVAL_RES(return_value, zend_register_resource(dupch, le_curl));
dupch->res = Z_RES_P(return_value);
}
--- /dev/null
+--TEST--
+Bug #79199 (curl_copy_handle() memory leak)
+--SKIPIF--
+<?php
+if (!extension_loaded('curl')) die('skip curl extension not available');
+?>
+--FILE--
+<?php
+$mem_old = 0;
+for($i = 0; $i < 50; ++$i) {
+ $c1 = curl_init();
+ $c2 = curl_copy_handle($c1);
+ curl_close($c2);
+ curl_close($c1);
+ $mem_new = memory_get_usage();
+ if ($mem_new <= $mem_old) {
+ break;
+ }
+ $mem_old = $mem_new;
+}
+echo $i < 50 ? "okay" : "leak", PHP_EOL;
+?>
+--EXPECT--
+okay