summaryrefslogtreecommitdiff
path: root/ext/spl/php_spl.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2010-04-27 13:31:55 +0000
committerDmitry Stogov <dmitry@php.net>2010-04-27 13:31:55 +0000
commit9424d420fb5aaaa2c19f566d926dcbc03f9e2474 (patch)
treea479a2468b0630ba5a51889b35b11c38265f00df /ext/spl/php_spl.c
parent8546225b6e7916d084f00d064480af1755a83c98 (diff)
downloadphp-git-9424d420fb5aaaa2c19f566d926dcbc03f9e2474.tar.gz
Fixed memory leak in ext/spl/tests/spl_autoload_bug48541.phpt
Diffstat (limited to 'ext/spl/php_spl.c')
-rwxr-xr-xext/spl/php_spl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 663baec014..06ab910175 100755
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -556,7 +556,14 @@ PHP_FUNCTION(spl_autoload_register)
}
}
- 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));