Bug #70228 [NEW]: Memleak if return in finally block

From: Date: Mon, 10 Aug 2015 13:27:36 +0000
Subject: Bug #70228 [NEW]: Memleak if return in finally block
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195086@lists.php.net to get a copy of this message
From:             laruence
Operating system: 
PHP version:      Irrelevant
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Memleak if return in finally block

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 ===

-- 
Edit bug report at https://bugs.php.net/bug.php?id=70228&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=70228&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=70228&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=70228&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=70228&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=70228&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=70228&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=70228&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=70228&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=70228&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=70228&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=70228&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=70228&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=70228&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70228&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=70228&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=70228&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=70228&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70228&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=70228&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=70228&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#195086) next »