php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56087 tidy mem leaks under some circumstances
Submitted: 2004-06-08 07:47 UTC Modified: 2004-06-08 10:49 UTC
From: chregu@php.net Assigned: iliaa (profile)
Status: Closed Package: tidy (PECL)
PHP Version: 5CVS-2004-06-08 (dev) OS: Mac OS X 10.3
Private report: No CVE-ID: None
 [2004-06-08 07:47 UTC] chregu@php.net
Description:
------------
The following code reports 2 memleaks:

/opt/cvs/php5/ext/tidy/tidy.c(364) :  Freeing 0x00415C70 (16 bytes), 
script=/usr/local/bxphp/apache/htdocs/tidy.php
/opt/cvs/php5/ext/tidy/tidy.c(357) :  Freeing 0x00415C20 (16 bytes), 
script=/usr/local/bxphp/apache/htdocs/tidy.php
=== Total 2 memory leaks detected ===

First one for the array_merge code (if I remove the array_merge, the 
memleak disappears)

The second one for the 3rd param as an element of the 2nd param 
array. If I just add the value "utf8" there, it doesn't memleak.

Don't question the code, it's just a stripdown of a more complex one ;)

Reproduce code:
---------------
$html = "foo";
$options = array("char-encoding" => "utf8","drop-proprietary-attributes" => "yes");
$options2 = array("drop-proprietary-attributes" => "no");
$options = array_merge($options,$options2);
 
$tidy = new tidy();
$tidy->parseString($html,$options,$options['char-encoding']);
print $tidy;


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-08 10:49 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, 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/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 23:01:34 2024 UTC