|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36492 stream_filter_register causes memory leaks
Submitted: 2006-02-23 06:33 UTC Modified: 2007-08-04 07:56 UTC
From: sqchen at citiz dot net Assigned: pollita (profile)
Status: Closed Package: Streams related
PHP Version: 5.2CVS-2007-07-23 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: sqchen at citiz dot net
New email:
PHP Version: OS:


 [2006-02-23 06:33 UTC] sqchen at citiz dot net
stream_filter_register cause memory leaks when the php version is 5.1.2 and add --enable-debug parameter

Reproduce code:
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");

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 ===


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-23 06:56 UTC] 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) {
php-5.1.1 have not, bug php-5.1.2 have.
 [2006-02-23 17:07 UTC]
assigned to the other maintainer
 [2007-07-23 12:14 UTC]
Still happens with latest 5.2CVS checkout.
 [2007-08-04 07:56 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 15 16:01:28 2024 UTC