#35968 [Opn->Csd]: Memory leak if exception thrown within switch
| From: | derick@php.net | Date: | Wed, 11 Jan 2006 07:25:58 +0000 |
| Subject: | #35968 [Opn->Csd]: Memory leak if exception thrown within switch | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-91758@lists.php.net to get a copy of this message | ||
ID: 35968
Updated by: derick@php.net
Reported By: levi at alliancesoftware dot com dot au
-Status: Open
+Status: Closed
Bug Type: Scripting Engine problem
PHP Version: 5CVS-2006-01-11 (CVS)
New Comment:
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at
http://www.php.net/downloads.php
The upgrade path from PHP 5.0 is PHP 5.1.1. So simply use PHP 5.1.1...
Besides that, this is not a critical problem as PHP will clean it up at
the end of the request.
Previous Comments:
------------------------------------------------------------------------
[2006-01-11 07:40:49] levi at alliancesoftware dot com dot au
Description:
------------
A memory leak occurs if an exception is thrown within a switch($var)
block
The leak does not occur if the switch is made on a constant [eg
switch(5)]
Occurs in 5.0.5, but not in 5.1.1
It *does* however still appear in 5.0-CVS (2006-01-11) -- maybe the bug
was 'accidentally' fixed in 5.1; I couldn't find any reference to it in
the bugs list.
If it was a deliberatel fix in 5.1, can the fix be backported to the
5.0 tree too?
Reproduce code:
---------------
#!/usr/local/src/php5/php-5.0CVS/php-src/sapi/cli/php
<?
try {
$x = 0;
switch ($x) {
default:
throw new Exception('bad thing happened');
}
} catch (Exception $z) {
}
?>
Expected result:
----------------
Nothing
Actual result:
--------------
With --enable-debug:
/usr/local/src/php5/php-5.0CVS/php-src/Zend/zend_execute.c(675) :
Freeing 0x09A4C354 (16 byt
es), script=./tX.php5
=== Total 1 memory leaks detected ===
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35968&edit=1