1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 17:22:15 +01:00
Files
archived-php-src/ext/curl/tests/bug79199.phpt
Christoph M. Becker 2b5fc8e325 Fix #79199: curl_copy_handle() memory leak
`curl_copy_handle()` already registers a new resource, so we must not
increase the refcount of the original resource.
2020-03-12 11:23:53 +01:00

25 lines
477 B
PHP

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