Skip to content

Commit 35f6f9b

Browse files
committed
Fix use-after-free of ZCG(cwd) in Zend Optimizer
1 parent c339d52 commit 35f6f9b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,6 +2370,11 @@ static void accel_deactivate(void)
23702370
*/
23712371
TSRMLS_FETCH();
23722372

2373+
if (ZCG(cwd)) {
2374+
efree(ZCG(cwd));
2375+
ZCG(cwd) = NULL;
2376+
}
2377+
23732378
if (!ZCG(enabled) || !accel_startup_ok) {
23742379
return;
23752380
}
@@ -2383,12 +2388,6 @@ static void accel_deactivate(void)
23832388
zend_accel_fast_shutdown(TSRMLS_C);
23842389
}
23852390
#endif
2386-
2387-
if (ZCG(cwd)) {
2388-
efree(ZCG(cwd));
2389-
ZCG(cwd) = NULL;
2390-
}
2391-
23922391
}
23932392

23942393
static int accelerator_remove_cb(zend_extension *element1, zend_extension *element2)

0 commit comments

Comments
 (0)