colder Sat Jul 19 13:13:44 2008 UTC
Modified files:
/php-src/ext/spl spl_array.c
Log:
Fix valgrind errors in array_method, and possibly #45349 (Thanks tony for the
patch)
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.140&r2=1.141&diff_format=u
Index: php-src/ext/spl/spl_array.c
diff -u php-src/ext/spl/spl_array.c:1.140 php-src/ext/spl/spl_array.c:1.141
--- php-src/ext/spl/spl_array.c:1.140 Sun Jul 6 23:45:38 2008
+++ php-src/ext/spl/spl_array.c Sat Jul 19 13:13:44 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_array.c,v 1.140 2008/07/06 23:45:38 colder Exp $ */
+/* $Id: spl_array.c,v 1.141 2008/07/19 13:13:44 colder Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -1235,11 +1235,11 @@
{
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 *tmp, *arg;
- INIT_PZVAL(&tmp);
- Z_TYPE(tmp) = IS_ARRAY;
- Z_ARRVAL(tmp) = aht;
+ MAKE_STD_ZVAL(tmp);
+ Z_TYPE_P(tmp) = IS_ARRAY;
+ Z_ARRVAL_P(tmp) = aht;
if (use_arg) {
if (ZEND_NUM_ARGS() != 1 ||
zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
"z", &arg) == FAILURE) {
@@ -1247,11 +1247,13 @@
return;
}
zval_ptr_dtor(return_value_ptr);
- 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,
return_value_ptr, 2, tmp, arg TSRMLS_CC);
} else {
zval_ptr_dtor(return_value_ptr);
- 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,
return_value_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);
} /* }}} */
/* {{{ SPL_ARRAY_METHOD */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php