dmitry Tue, 27 Apr 2010 13:31:55 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=298660
Log: Fixed memory leak in ext/spl/tests/spl_autoload_bug48541.phpt Bug: http://bugs.php.net/48541 (Closed) spl_autoload_register only registers first closure, then leaks the others Changed paths: U php/php-src/trunk/ext/spl/php_spl.c Modified: php/php-src/trunk/ext/spl/php_spl.c =================================================================== --- php/php-src/trunk/ext/spl/php_spl.c 2010-04-27 13:15:07 UTC (rev 298659) +++ php/php-src/trunk/ext/spl/php_spl.c 2010-04-27 13:31:55 UTC (rev 298660) @@ -556,7 +556,14 @@ } } - zend_hash_add(SPL_G(autoload_functions), lc_name, func_name_len+1, &alfi.func_ptr, sizeof(autoload_func_info), NULL); + if (zend_hash_add(SPL_G(autoload_functions), lc_name, func_name_len+1, &alfi.func_ptr, sizeof(autoload_func_info), NULL) == FAILURE) { + if (obj_ptr && !(alfi.func_ptr->common.fn_flags & ZEND_ACC_STATIC)) { + Z_DELREF_P(alfi.obj); + } + if (alfi.closure) { + Z_DELREF_P(alfi.closure); + } + } if (prepend && SPL_G(autoload_functions)->nNumOfElements > 1) { /* Move the newly created element to the head of the hashtable */ HT_MOVE_TAIL_TO_HEAD(SPL_G(autoload_functions));
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php