php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70228 Memleak if return in finally block
Submitted: 2015-08-10 13:27 UTC Modified: 2016-06-07 11:12 UTC
From: laruence@php.net Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2015-08-10 13:27 UTC] laruence@php.net
Description:
------------
see test script.



Test script:
---------------
<?php

function foo() {
    try { return chr(0) . "bar"; }
    finally { return chr(32) . "bad"; }
}

var_dump(foo());
?>

Expected result:
----------------
none memleak

Actual result:
--------------
$ sapi/cli/php /tmp/1.php
string(4) " bad"

[Mon Aug 10 21:21:03 2015]  Script:  '/tmp/1.php'
/home/huixinchen/opensource/trunk/Zend/zend_string.h(121) :  Freeing 0x7F1086059CC0 (32 bytes), script=/tmp/1.php
=== Total 1 memory leaks detected ===

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-08-10 14:03 UTC] laruence@php.net
-Status: Open +Status: Suspended
 [2015-08-10 14:03 UTC] laruence@php.net
I am going to suspend this , because without a big change this could be fixed. and we already at beta stage of PHP7...
 [2016-06-07 11:12 UTC] dmitry@php.net
-Status: Suspended +Status: Assigned -Assigned To: +Assigned To: dmitry
 [2016-06-07 21:23 UTC] dmitry@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2bae4e18a2a0041bdbf0511cb4fed73c595f4050
Log: Fixed bug #70228 (Memleak if return in finally block)
 [2016-06-07 21:23 UTC] dmitry@php.net
-Status: Assigned +Status: Closed
 [2016-06-22 05:58 UTC] krakjoe@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2bae4e18a2a0041bdbf0511cb4fed73c595f4050
Log: Fixed bug #70228 (Memleak if return in finally block)
 [2016-07-20 11:30 UTC] davey@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2bae4e18a2a0041bdbf0511cb4fed73c595f4050
Log: Fixed bug #70228 (Memleak if return in finally block)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC