summaryrefslogtreecommitdiff
path: root/Zend/zend_exceptions.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2010-08-16 08:11:08 +0000
committerDmitry Stogov <dmitry@php.net>2010-08-16 08:11:08 +0000
commite461c22ea97e1ee7721e45c3627519e939844095 (patch)
treeab08faefe72305d25a4b65a1097adb3bd6f0fc18 /Zend/zend_exceptions.c
parent0ff6f90446f4d085a535b68da7855ee27bed2fa0 (diff)
downloadphp-git-e461c22ea97e1ee7721e45c3627519e939844095.tar.gz
Fixed memory leaks (related to bug #52361)
Diffstat (limited to 'Zend/zend_exceptions.c')
-rw-r--r--Zend/zend_exceptions.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index abed6c7f84..73cf2bdaf4 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -81,7 +81,7 @@ void zend_exception_restore(TSRMLS_D) /* {{{ */
}
/* }}} */
-void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
+ZEND_API void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
{
#ifdef HAVE_DTRACE
if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
@@ -580,6 +580,7 @@ ZEND_METHOD(exception, __toString)
zend_call_function(&fci, NULL TSRMLS_CC);
if (Z_TYPE_P(trace) != IS_STRING) {
+ zval_ptr_dtor(&trace);
trace = NULL;
}
@@ -600,6 +601,11 @@ ZEND_METHOD(exception, __toString)
zval_dtor(&line);
exception = zend_read_property(default_exception_ce, exception, "previous", sizeof("previous")-1, 0 TSRMLS_CC);
+
+ if (trace) {
+ zval_ptr_dtor(&trace);
+ }
+
}
zval_dtor(&fname);
@@ -607,10 +613,6 @@ ZEND_METHOD(exception, __toString)
* the result in uncaught exception handlers without memleaks. */
zend_update_property_string(default_exception_ce, getThis(), "string", sizeof("string")-1, str TSRMLS_CC);
- if (trace) {
- zval_ptr_dtor(&trace);
- }
-
RETURN_STRINGL(str, len, 0);
}
/* }}} */