]> granicus.if.org Git - php/commitdiff
Fix use-after-free of ZCG(cwd) in Zend Optimizer
authorYussuf Khalil <dev@pp3345.net>
Wed, 10 Feb 2016 09:33:57 +0000 (10:33 +0100)
committerYussuf Khalil <dev@pp3345.net>
Wed, 10 Feb 2016 09:33:57 +0000 (10:33 +0100)
ext/opcache/ZendAccelerator.c

index 66b54f2ebf2a1f5d94406e4bd7c63470c3314334..0f66c56ea65d068bc36af67b014802f2d5bc9700 100644 (file)
@@ -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)