mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Fix possible exit_counters memory leak in ZTS build
This commit is contained in:
commit
29efbe593d
2 changed files with 18 additions and 4 deletions
|
@ -4734,6 +4734,13 @@ static void zend_jit_globals_ctor(zend_jit_globals *jit_globals)
|
|||
zend_jit_trace_init_caches();
|
||||
}
|
||||
|
||||
#ifdef ZTS
|
||||
static void zend_jit_globals_dtor(zend_jit_globals *jit_globals)
|
||||
{
|
||||
zend_jit_trace_free_caches();
|
||||
}
|
||||
#endif
|
||||
|
||||
static int zend_jit_parse_config_num(zend_long jit)
|
||||
{
|
||||
if (jit == 0) {
|
||||
|
@ -4846,7 +4853,7 @@ ZEND_EXT_API int zend_jit_debug_config(zend_long old_val, zend_long new_val, int
|
|||
ZEND_EXT_API void zend_jit_init(void)
|
||||
{
|
||||
#ifdef ZTS
|
||||
jit_globals_id = ts_allocate_id(&jit_globals_id, sizeof(zend_jit_globals), (ts_allocate_ctor) zend_jit_globals_ctor, NULL);
|
||||
jit_globals_id = ts_allocate_id(&jit_globals_id, sizeof(zend_jit_globals), (ts_allocate_ctor) zend_jit_globals_ctor, zend_jit_globals_dtor);
|
||||
#else
|
||||
zend_jit_globals_ctor(&jit_globals);
|
||||
#endif
|
||||
|
@ -5054,9 +5061,9 @@ ZEND_EXT_API void zend_jit_shutdown(void)
|
|||
zend_jit_perf_jitdump_close();
|
||||
}
|
||||
#endif
|
||||
if (JIT_G(exit_counters)) {
|
||||
free(JIT_G(exit_counters));
|
||||
}
|
||||
#ifndef ZTS
|
||||
zend_jit_trace_free_caches();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void zend_jit_reset_counters(void)
|
||||
|
|
|
@ -8385,6 +8385,13 @@ static void zend_jit_trace_reset_caches(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void zend_jit_trace_free_caches(void)
|
||||
{
|
||||
if (JIT_G(exit_counters)) {
|
||||
free(JIT_G(exit_counters));
|
||||
}
|
||||
}
|
||||
|
||||
static void zend_jit_trace_restart(void)
|
||||
{
|
||||
ZEND_JIT_TRACE_NUM = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue