Skip to content

Commit b2d78ae

Browse files
committed
Backport accel_globals->key leak fix (8.3)
Closes GH-18602.
1 parent 41e11a6 commit b2d78ae

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ PHP NEWS
3434
memory_consumption or jit_buffer_size). (nielsdos)
3535
. Fixed bug GH-18567 (Preloading with internal class alias triggers assertion
3636
failure). (nielsdos)
37+
. Fix leak of accel_globals->key. (nielsdos)
3738

3839
- PDO_OCI:
3940
. Fixed bug GH-18494 (PDO OCI segfault in statement GC). (nielsdos)

ext/opcache/ZendAccelerator.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2937,12 +2937,10 @@ static void accel_globals_ctor(zend_accel_globals *accel_globals)
29372937
GC_MAKE_PERSISTENT_LOCAL(accel_globals->key);
29382938
}
29392939

2940-
#ifdef ZTS
29412940
static void accel_globals_dtor(zend_accel_globals *accel_globals)
29422941
{
29432942
zend_string_free(accel_globals->key);
29442943
}
2945-
#endif
29462944

29472945
#ifdef HAVE_HUGE_CODE_PAGES
29482946
# ifndef _WIN32
@@ -3384,6 +3382,8 @@ void accel_shutdown(void)
33843382
if (!ZCG(enabled) || !accel_startup_ok) {
33853383
#ifdef ZTS
33863384
ts_free_id(accel_globals_id);
3385+
#else
3386+
accel_globals_dtor(&accel_globals);
33873387
#endif
33883388
return;
33893389
}
@@ -3398,6 +3398,8 @@ void accel_shutdown(void)
33983398

33993399
#ifdef ZTS
34003400
ts_free_id(accel_globals_id);
3401+
#else
3402+
accel_globals_dtor(&accel_globals);
34013403
#endif
34023404

34033405
if (!_file_cache_only) {

0 commit comments

Comments
 (0)