com php-src: Fix leak in zend_exception_error: Zend/zen d_exceptions.c
| From: | Nikita Popov | Date: | Sat, 01 Oct 2016 17:04:31 +0000 |
| Subject: | com php-src: Fix leak in zend_exception_error: Zend/zen d_exceptions.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94811@lists.php.net to get a copy of this message | ||
Commit: f9d4b1a3f10765bae8e6a7ce950daaaf90f983f0
Author: Nikita Popov <nikic@php.net> Sat, 1 Oct 2016 19:03:54 +0200
Parents: 9acfb1a3a5268febb123b7e5fbd4eaf072c83537
Branches: PHP-5.6 PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f9d4b1a3f10765bae8e6a7ce950daaaf90f983f0
Log:
Fix leak in zend_exception_error
Only occurs if a non-fatal severity level is used, e.g. when using
interactive mode.
Changed paths:
M Zend/zend_exceptions.c
Diff:
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index fda4d21..95d18f4 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -893,11 +893,10 @@ static void zend_error_va(int type, const char *file, uint lineno, const char
*f
ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {{{ */
{
zend_class_entry *ce_exception = Z_OBJCE_P(exception);
+ EG(exception) = NULL;
if (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {
zval *str, *file, *line;
- EG(exception) = NULL;
-
zend_call_method_with_0_params(&exception, ce_exception, NULL, "__tostring",
&str);
if (!EG(exception)) {
if (Z_TYPE_P(str) != IS_STRING) {
@@ -936,6 +935,7 @@ ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {
} else {
zend_error(severity, "Uncaught exception '%s'", ce_exception->name);
}
+ zval_ptr_dtor(&exception);
}
/* }}} */