php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1990 memory leak in switch() statement
Submitted: 1999-08-07 16:28 UTC Modified: 1999-08-07 18:42 UTC
From: danny dot heijl at cevi dot be Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Latest CVS (07/08/1999) OS: RH 5.2 Linux
Private report: No CVE-ID: None
 [1999-08-07 16:28 UTC] danny dot heijl at cevi dot be
The following script (/php3/test/lang/021.php3t) leaks memory :
<?php 

for ($i=0; $i<=5; $i++)
{
  echo "i=$i\n";
  
  switch($i) {
    case 0:
      echo "In branch 0\n";
      break;
    case 1:
      echo "In branch 1\n";
      break;
    case 2:
      echo "In branch 2\n";
      break;
    case 3:
      echo "In branch 3\n";
      break 2;
    case 4:
      echo "In branch 4\n";
      break;
    default:
      echo "In default\n";
      break;
  }
}
echo "hi\n";
?>
Content-Type: text/html

i=0
In branch 0
i=1
In branch 1
i=2
In branch 2
i=3
In branch 3
hi

/tmp/switch1.php3:  Freeing 0x08215948 (37 bytes), allocated in zend_hash.c on line 175<br>

Same goes for test/lang/022.php3t and test/lang/023.php3t


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-08-07 18:42 UTC] zeev at cvs dot php dot net
Fixed - thanks for reporting it!
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC