php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46205 Closure - Memory leaks when ReflectionException is thrown
Submitted: 2008-09-30 19:48 UTC Modified: 2008-10-01 07:31 UTC
From: felipe@php.net Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS-2008-09-30 (CVS) OS:
Private report: No CVE-ID: None
 [2008-09-30 19:48 UTC] felipe@php.net
Description:
------------
See below.

Reproduce code:
---------------
<?php

$x = new reflectionmethod('reflectionparameter', 'export');
$y = function() { };

try {
	$x->invokeArgs(new reflectionparameter('trim', 'str'), array($y, 1));
} catch (Exception $e) { }



Actual result:
--------------
==5847== 9 bytes in 1 blocks are indirectly lost in loss record 1 of 2
==5847==    at 0x4021620: malloc (vg_replace_malloc.c:149)
==5847==    by 0x83CEAC1: _emalloc (zend_alloc.c:2285)
==5847==    by 0x83CF03E: _estrndup (zend_alloc.c:2440)
==5847==    by 0x841DFB7: zend_get_closure_invoke_method (zend_closures.c:113)
==5847==    by 0x818AECF: zim_reflection_parameter___construct (php_reflection.c:1959)
==5847==    by 0x83E7E0C: zend_call_function (zend_execute_API.c:907)
==5847==    by 0x8188075: _reflection_export (php_reflection.c:1286)
==5847==    by 0x818A78B: zim_reflection_parameter_export (php_reflection.c:1863)
==5847==    by 0x83E7E0C: zend_call_function (zend_execute_API.c:907)
==5847==    by 0x818DA96: zim_reflection_method_invokeArgs (php_reflection.c:2618)
==5847==    by 0x8428148: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:315)
==5847==    by 0x84291DC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:428)
==5847==    by 0x842706B: execute (zend_vm_execute.h:104)
==5847==    by 0x83F875C: zend_execute_scripts (zend.c:1197)
==5847==    by 0x836FBB7: php_execute_script (main.c:2080)
==5847==    by 0x8497743: main (php_cli.c:1130)
==5847== 
==5847== 
==5847== 153 (144 direct, 9 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 2
==5847==    at 0x4021620: malloc (vg_replace_malloc.c:149)
==5847==    by 0x83CEAC1: _emalloc (zend_alloc.c:2285)
==5847==    by 0x841DF15: zend_get_closure_invoke_method (zend_closures.c:105)
==5847==    by 0x818AECF: zim_reflection_parameter___construct (php_reflection.c:1959)
==5847==    by 0x83E7E0C: zend_call_function (zend_execute_API.c:907)
==5847==    by 0x8188075: _reflection_export (php_reflection.c:1286)
==5847==    by 0x818A78B: zim_reflection_parameter_export (php_reflection.c:1863)
==5847==    by 0x83E7E0C: zend_call_function (zend_execute_API.c:907)
==5847==    by 0x818DA96: zim_reflection_method_invokeArgs (php_reflection.c:2618)
==5847==    by 0x8428148: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:315)
==5847==    by 0x84291DC: ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (zend_vm_execute.h:428)
==5847==    by 0x842706B: execute (zend_vm_execute.h:104)
==5847==    by 0x83F875C: zend_execute_scripts (zend.c:1197)
==5847==    by 0x836FBB7: php_execute_script (main.c:2080)
==5847==    by 0x8497743: main (php_cli.c:1130)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-01 07:31 UTC] dmitry@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 05:01:30 2024 UTC