From: thomas at koch dot ro
Operating system: Debian Lenny
PHP version: 5.3CVS-2008-11-28 (CVS)
PHP Bug Type: cURL related
Bug description: cUrl leaks memory
Description:
------------
Setting cURL options in a foreach leaks memory
Reproduce code:
---------------
$ch = curl_init();
$opt = array(
CURLOPT_AUTOREFERER => TRUE,
CURLOPT_BINARYTRANSFER => TRUE
);
// This works fine:
//curl_setopt( $ch, CURLOPT_AUTOREFERER , TRUE );
//curl_setopt( $ch, CURLOPT_BINARYTRANSFER , TRUE );
// setting the options in a foreach leads to memory leaks
foreach( $opt as $option => $value ) {
curl_setopt( $ch, $option, $value );
}
Expected result:
----------------
no output
Actual result:
--------------
[Fri Nov 28 17:01:18 2008] Script: '/home/ymc-toko/curl_bug.php'
/var/checkouts/php5_3/ext/curl/interface.c(1505) : Freeing 0x030C6BE8 (32
bytes), script=/home/ymc-toko/curl_bug.php
[Fri Nov 28 17:01:18 2008] Script: '/home/ymc-toko/curl_bug.php'
/var/checkouts/php5_3/ext/curl/interface.c(1397) : Freeing 0x030C6C68 (32
bytes), script=/home/ymc-toko/curl_bug.php
=== Total 2 memory leaks detected ===
--
Edit bug report at http://bugs.php.net/?id=46711&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46711&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46711&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46711&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=46711&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=46711&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=46711&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=46711&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=46711&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=46711&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=46711&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=46711&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46711&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46711&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=46711&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46711&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46711&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=46711&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=46711&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=46711&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=46711&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=46711&r=mysqlcfg