php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79199 curl_copy_handle() memory leak
Submitted: 2020-01-31 01:42 UTC Modified: 2020-03-11 22:27 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: admin at yurunsoft dot com Assigned: cmb (profile)
Status: Closed Package: cURL related
PHP Version: Irrelevant OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
25 - 10 = ?
Subscribe to this entry?

 
 [2020-01-31 01:42 UTC] admin at yurunsoft dot com
Description:
------------
---
From manual page: https://php.net/function.curl-copy-handle
---

When I use PHP >= 7.0

curl_copy_handle() memory leak

But, when I use PHP <= 5.6 it's OK!


Test script:
---------------
<?php
for($i = 0; $i < 5; ++$i)
{
    $c1 = curl_init();
    $c2 = curl_copy_handle($c1);
    curl_close($c2);
    curl_close($c1);
    var_dump(memory_get_usage());
}
var_dump(PHP_VERSION);


Expected result:
----------------
int(120784)
int(120824)
int(120824)
int(120824)
int(120824)
string(6) "5.6.27"

Actual result:
--------------
int(869760)
int(869816)
int(870160)
int(870184)
int(870208)
string(23) "7.2.19-0ubuntu0.18.04.1"

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-01-31 15:53 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2020-01-31 15:53 UTC] cmb@php.net
Indeed, we're leaking the original curl handle zval.  I wonder why
we increase its refcount[1].

[1] <https://github.com/php/php-src/blob/php-7.3.14/ext/curl/interface.c#L2166>
 [2020-03-11 22:27 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #79199: curl_copy_handle() memory leak
On GitHub:  https://github.com/php/php-src/pull/5258
Patch:      https://github.com/php/php-src/pull/5258.patch
 [2020-03-11 22:27 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2020-03-12 10:29 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2b5fc8e325e3f385851ab7a7a77010bbccd2b16e
Log: Fix #79199: curl_copy_handle() memory leak
 [2020-03-12 10:29 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 18:01:29 2024 UTC