ID: 27295 Updated by: [EMAIL PROTECTED] Reported By: jwalker7281 at yahoo dot com -Status: Assigned +Status: Closed -Bug Type: Zend Engine 2 problem +Bug Type: Scripting Engine problem Operating System: Redhat Linux 9 PHP Version: 4CVS, 5CVS Assigned To: iliaa New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2004-02-17 15:14:05] jwalker7281 at yahoo dot com Description: ------------ I found that using sscanf, at least within a foreach loop, leaks. The original code I found this in read in a file, and then did foreach( $lines as $line )... I wrote a small bit of code to simulate that. It doesn't give the same files for a leak location, but it still leaks. When running my code, I got this: /root/php-5.0.0b4/Zend/zend_execute.c(2973) : Freeing 0x40232D30 (2 bytes), script=./objtest /root/php-5.0.0b4/Zend/zend_variables.c(137) : Actual location (location was relayed) === Total 1 memory leaks detected === When running this test simulation code, I got this: /root/php-5.0.0b4/ext/standard/scanf.c(937) : Freeing 0x4022727C (4 bytes), script=./memleak === Total 1 memory leaks detected === Both are running PHP5, b4 in CLI mode. Reproduce code: --------------- #!/usr/local/bin/php -q <?php $strings = array( "#dude = me\n", "#bug = nasty\n" ); foreach( $strings as $string ) { sscanf( $string, "%s = %[^[]]", $var, $val ); echo "$var = $val\n"; } ?> Expected result: ---------------- It *works*, as in it outputs: ./memleak #dude = me #bug = nasty But it also gives that memory leak bug. Actual result: -------------- Please see above. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27295&edit=1
