Backport accel_globals->key leak fix (8.3)

Closes GH-18602.
This commit is contained in:
Niels Dossche 2025-05-19 19:37:34 +02:00
parent 41e11a627d
commit b2d78ae00c
No known key found for this signature in database
GPG key ID: B8A8AD166DF0E2E5
2 changed files with 5 additions and 2 deletions

1
NEWS
View file

@ -34,6 +34,7 @@ PHP NEWS
memory_consumption or jit_buffer_size). (nielsdos)
. Fixed bug GH-18567 (Preloading with internal class alias triggers assertion
failure). (nielsdos)
. Fix leak of accel_globals->key. (nielsdos)
- PDO_OCI:
. Fixed bug GH-18494 (PDO OCI segfault in statement GC). (nielsdos)

View file

@ -2937,12 +2937,10 @@ static void accel_globals_ctor(zend_accel_globals *accel_globals)
GC_MAKE_PERSISTENT_LOCAL(accel_globals->key);
}
#ifdef ZTS
static void accel_globals_dtor(zend_accel_globals *accel_globals)
{
zend_string_free(accel_globals->key);
}
#endif
#ifdef HAVE_HUGE_CODE_PAGES
# ifndef _WIN32
@ -3384,6 +3382,8 @@ void accel_shutdown(void)
if (!ZCG(enabled) || !accel_startup_ok) {
#ifdef ZTS
ts_free_id(accel_globals_id);
#else
accel_globals_dtor(&accel_globals);
#endif
return;
}
@ -3398,6 +3398,8 @@ void accel_shutdown(void)
#ifdef ZTS
ts_free_id(accel_globals_id);
#else
accel_globals_dtor(&accel_globals);
#endif
if (!_file_cache_only) {