php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sqchen at citiz dot net
New email:
PHP Version: OS:

 

 [2006-02-23 06:33 UTC] 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 ===


Patches

Pull Requests

History

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) {
		return;
"
php-5.1.1 have not, bug php-5.1.2 have.
 [2006-02-23 17:07 UTC] wez@php.net
assigned to the other maintainer
 [2007-07-23 12:14 UTC] jani@php.net
Still happens with latest 5.2CVS checkout.
 [2007-08-04 07:56 UTC] pollita@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC