svn: /php/php-src/ branches/PHP_5_3/Zend/zend_exceptions.c trunk/Zend/zend_exceptions.c
| From: | Dmitry Stogov | Date: | Mon, 16 Aug 2010 08:11:08 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/Zend/zend_exceptions.c trunk/Zend/zend_exceptions.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-63293@lists.php.net to get a copy of this message | ||
dmitry Mon, 16 Aug 2010 08:11:08 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=302311
Log:
Fixed memory leaks (related to bug #52361)
Bug: http://bugs.php.net/52361 (Assigned) Throwing an
exception in a destructor causes invalid catching
Changed paths:
U php/php-src/branches/PHP_5_3/Zend/zend_exceptions.c
U php/php-src/trunk/Zend/zend_exceptions.c
Modified: php/php-src/branches/PHP_5_3/Zend/zend_exceptions.c
===================================================================
--- php/php-src/branches/PHP_5_3/Zend/zend_exceptions.c 2010-08-16 06:06:38 UTC (rev 302310)
+++ php/php-src/branches/PHP_5_3/Zend/zend_exceptions.c 2010-08-16 08:11:08 UTC (rev 302311)
@@ -572,6 +572,7 @@
zend_call_function(&fci, NULL TSRMLS_CC);
if (Z_TYPE_P(trace) != IS_STRING) {
+ zval_ptr_dtor(&trace);
trace = NULL;
}
@@ -592,6 +593,10 @@
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);
@@ -599,10 +604,6 @@
* 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);
}
/* }}} */
Modified: php/php-src/trunk/Zend/zend_exceptions.c
===================================================================
--- php/php-src/trunk/Zend/zend_exceptions.c 2010-08-16 06:06:38 UTC (rev 302310)
+++ php/php-src/trunk/Zend/zend_exceptions.c 2010-08-16 08:11:08 UTC (rev 302311)
@@ -81,7 +81,7 @@
}
/* }}} */
-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_call_function(&fci, NULL TSRMLS_CC);
if (Z_TYPE_P(trace) != IS_STRING) {
+ zval_ptr_dtor(&trace);
trace = NULL;
}
@@ -600,6 +601,11 @@
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 @@
* 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);
}
/* }}} */