xref: /php-src/ext/curl/tests/bug79199.phpt (revision 74859783)
1--TEST--
2Bug #79199 (curl_copy_handle() memory leak)
3--EXTENSIONS--
4curl
5--FILE--
6<?php
7$mem_old = 0;
8for($i = 0; $i < 50; ++$i) {
9    $c1 = curl_init();
10    $c2 = curl_copy_handle($c1);
11    curl_close($c2);
12    curl_close($c1);
13    $mem_new = memory_get_usage();
14    if ($mem_new <= $mem_old) {
15        break;
16    }
17    $mem_old = $mem_new;
18}
19echo $i < 50 ? "okay" : "leak", PHP_EOL;
20?>
21--EXPECT--
22okay
23