moriyoshi Sun Oct 26 11:10:08 2003 EDT
Added files: (Branch: PHP_4_3)
/php-src/tests/lang overload_leak.phpt
Modified files:
/php-src/ext/overload overload.c
Log:
Prevent leaks in the overload extension that occur in some special cases.
Index: php-src/ext/overload/overload.c
diff -u php-src/ext/overload/overload.c:1.20.2.3
php-src/ext/overload/overload.c:1.20.2.4
--- php-src/ext/overload/overload.c:1.20.2.3 Tue Apr 15 00:14:21 2003
+++ php-src/ext/overload/overload.c Sun Oct 26 11:10:05 2003
@@ -580,18 +580,16 @@
}
if (zval_is_true(retval)) {
- *return_value = *result_ptr;
- INIT_PZVAL(return_value);
+ REPLACE_ZVAL_VALUE(&return_value, result_ptr, 1);
} else {
zval_dtor(result_ptr);
php_error(E_WARNING, "Call to undefined method %s::%s()",
Z_OBJCE_P(object)->name, Z_STRVAL(method_name));
}
zval_ptr_dtor(&retval);
} else {
- ZVAL_STRINGL(&call_handler, Z_STRVAL(method->element),
Z_STRLEN(method->element), 0);
call_result = call_user_function_ex(NULL,
&object,
-
&call_handler,
+
&method->element,
&retval,
ZEND_NUM_ARGS(), args,
0, NULL TSRMLS_CC);
@@ -602,8 +600,7 @@
return;
}
- *return_value = *retval;
- zval_copy_ctor(return_value);
+ REPLACE_ZVAL_VALUE(&return_value, retval, 1);
zval_ptr_dtor(&retval);
}
Index: php-src/tests/lang/overload_leak.phpt
+++ php-src/tests/lang/overload_leak.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php