From: Yussuf Khalil Date: Wed, 10 Feb 2016 09:33:57 +0000 (+0100) Subject: Fix use-after-free of ZCG(cwd) in Zend Optimizer X-Git-Tag: php-7.0.4RC1~20^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=35f6f9b0dbc683812badf3a8e38d1ec110fd7925;p=php Fix use-after-free of ZCG(cwd) in Zend Optimizer --- diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 66b54f2ebf..0f66c56ea6 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -2370,6 +2370,11 @@ static void accel_deactivate(void) */ TSRMLS_FETCH(); + if (ZCG(cwd)) { + efree(ZCG(cwd)); + ZCG(cwd) = NULL; + } + if (!ZCG(enabled) || !accel_startup_ok) { return; } @@ -2383,12 +2388,6 @@ static void accel_deactivate(void) zend_accel_fast_shutdown(TSRMLS_C); } #endif - - if (ZCG(cwd)) { - efree(ZCG(cwd)); - ZCG(cwd) = NULL; - } - } static int accelerator_remove_cb(zend_extension *element1, zend_extension *element2)