dmitry Fri Sep 19 12:48:34 2008 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/spl/tests bug46115.phpt
Modified files:
/php-src NEWS
/php-src/ext/spl spl_array.c
Log:
Fixed bug #46115 (Memory leak when calling a method using Reflection)
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.326&r2=1.2027.2.547.2.965.2.327&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.326
php-src/NEWS:1.2027.2.547.2.965.2.327
--- php-src/NEWS:1.2027.2.547.2.965.2.326 Thu Sep 18 16:09:18 2008
+++ php-src/NEWS Fri Sep 19 12:48:33 2008
@@ -10,6 +10,8 @@
- Fixed bug causing the algorithm parameter of mhash() to be modified. (Scott)
+- Fixed bug #46115 (Memory leak when calling a method using Reflection).
+ (Dmitry)
- Fixed bug #46106 (Memory leaks when using global statement). (Dmitry)
- Fixed bug #46099 (Xsltprocessor::setProfiling - memory leak). (Felipe, Rob).
- Fixed bug #46087 (DOMXPath - segfault on destruction of a cloned object).
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.13.2.24&r2=1.71.2.17.2.13.2.25&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.24
php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.25
--- php-src/ext/spl/spl_array.c:1.71.2.17.2.13.2.24 Mon Aug 25 19:38:04 2008
+++ php-src/ext/spl/spl_array.c Fri Sep 19 12:48:33 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_array.c,v 1.71.2.17.2.13.2.24 2008/08/25 19:38:04 rrichards Exp $
*/
+/* $Id: spl_array.c,v 1.71.2.17.2.13.2.25 2008/09/19 12:48:33 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -1235,6 +1235,7 @@
spl_array_object *intern =
(spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
zval *tmp, *arg;
+ zval *retval_ptr = NULL;
MAKE_STD_ZVAL(tmp);
Z_TYPE_P(tmp) = IS_ARRAY;
@@ -1245,12 +1246,15 @@
zend_throw_exception(spl_ce_BadMethodCallException,
"Function expects exactly one argument", 0 TSRMLS_CC);
return;
}
- zend_call_method(NULL, NULL, NULL, fname, fname_len,
return_value_ptr, 2, tmp, arg TSRMLS_CC);
+ zend_call_method(NULL, NULL, NULL, fname, fname_len,
&retval_ptr, 2, tmp, arg TSRMLS_CC);
} else {
- zend_call_method(NULL, NULL, NULL, fname, fname_len,
return_value_ptr, 1, tmp, NULL TSRMLS_CC);
+ zend_call_method(NULL, NULL, NULL, fname, fname_len,
&retval_ptr, 1, tmp, NULL TSRMLS_CC);
}
Z_TYPE_P(tmp) = IS_NULL; /* we want to destroy the zval, not the
hashtable */
zval_ptr_dtor(&tmp);
+ if (retval_ptr) {
+ COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
+ }
} /* }}} */
#define SPL_ARRAY_METHOD(cname, fname, use_arg) \
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug46115.phpt?view=markup&rev=1.1
Index: php-src/ext/spl/tests/bug46115.phpt
+++ php-src/ext/spl/tests/bug46115.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php