#36492 [Asn->Csd]: stream_filter_register causes memory leaks
| From: | pollita@php.net | Date: | Sat, 04 Aug 2007 07:56:36 +0000 |
| Subject: | #36492 [Asn->Csd]: stream_filter_register causes memory leaks | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-115740@lists.php.net to get a copy of this message | ||
ID: 36492
Updated by: pollita@php.net
Reported By: sqchen at citiz dot net
-Status: Assigned
+Status: Closed
Bug Type: Streams related
Operating System: *
PHP Version: 5.2CVS-2007-07-23
Assigned To: pollita
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:
------------------------------------------------------------------------
[2007-07-23 12:14:07] jani@php.net
Still happens with latest 5.2CVS checkout.
------------------------------------------------------------------------
[2006-02-23 17:07:37] wez@php.net
assigned to the other maintainer
------------------------------------------------------------------------
[2006-02-23 06:56:46] sqchen at citiz dot net
I think it is actully stream_filter_append() function cause memory
leaks,
attention: php-5.1.1 will not cause memory leaks, I have compare the
source code of php-5.1.1 with php-5.1.2, and I found there are only
little difference in ~\main\streams\filter.c line 207-208.
"
if (brigade->tail == bucket) {
return;
"
php-5.1.1 have not, bug php-5.1.2 have.
------------------------------------------------------------------------
[2006-02-23 06:33:56] sqchen at citiz dot net
Description:
------------
stream_filter_register cause memory leaks when the php version is 5.1.2
and add --enable-debug parameter
Reproduce code:
---------------
<?php
class strtolower_filter extends php_user_filter{}
stream_filter_register("strtolower", "strtolower_filter");
$fp = fopen("foo-bar.txt", "w");
stream_filter_append($fp, "strtolower");
fwrite($fp, "Line1\n");
fwrite($fp, "WORD - 2\n");
fwrite($fp, "Easy As 123\n");
fclose($fp);
readfile("foo-bar.txt");
?>
Actual result:
--------------
[Thu Feb 23 13:32:38 2006] Script: 'stream_filter_register.php'
/home/sqchen/sqchen/php-5.1.2/main/streams/filter.c(78) : Freeing
0x083EEC14 (32 bytes), script=stream_filter_register.php
Last leak repeated 2 times
=== Total 3 memory leaks detected ===
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36492&edit=1