Bug #61072 [NEW]: Memory leak when restoring an exception handler

From: Date: Mon, 13 Feb 2012 16:49:01 +0000
Subject: Bug #61072 [NEW]: Memory leak when restoring an exception handler
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-167477@lists.php.net to get a copy of this message
From:             nikic
Operating system: 
PHP version:      Irrelevant
Package:          *General Issues
Bug Type:         Bug
Bug description:Memory leak when restoring an exception handler

Description:
------------
The script:

$callback = function() { };
set_exception_handler($callback);
restore_exception_handler();

Leaks:

[Mon Feb 13 17:34:31 2012]  Script:  'workingFile18.php'
/home/nikic/dev/php-src/Zend/zend_builtin_functions.c(1610) :  Freeing 
0xB7893050 (20 bytes), script=workingFile18.php
=== Total 1 memory leaks detected ===

Fixing it is just a matter of adding:

INIT_PZVAL(EG(user_exception_handler));

After http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_builtin_functions.c#1619.


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



Thread (3 messages)

« previous php.bugs (#167477) next »