PHP :: Bug #36492 :: stream_filter_register causes memory leaks
| 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 | ||
[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 commits
[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
[2007-07-23 12:14 UTC] jani@php.net
[2007-08-04 07:56 UTC] pollita@php.net