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