mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
- Fix leaks with registered shutdown functions.
This commit is contained in:
parent
2da8b014af
commit
6ffb0dcaf2
3 changed files with 16 additions and 6 deletions
|
@ -2282,14 +2282,21 @@ static int user_tick_function_compare(user_tick_function_entry * tick_fe1, user_
|
|||
}
|
||||
}
|
||||
|
||||
void php_call_shutdown_functions(void)
|
||||
void php_call_shutdown_functions(TSRMLS_D)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (BG(user_shutdown_function_names))
|
||||
zend_try {
|
||||
zend_hash_apply(BG(user_shutdown_function_names), (apply_func_t) user_shutdown_function_call TSRMLS_CC);
|
||||
memcpy(&EG(bailout), &orig_bailout, sizeof(jmp_buf));
|
||||
php_free_shutdown_functions(TSRMLS_C);
|
||||
}
|
||||
zend_end_try();
|
||||
}
|
||||
|
||||
void php_free_shutdown_functions(TSRMLS_D)
|
||||
{
|
||||
if (BG(user_shutdown_function_names))
|
||||
zend_try {
|
||||
zend_hash_destroy(BG(user_shutdown_function_names));
|
||||
FREE_HASHTABLE(BG(user_shutdown_function_names));
|
||||
BG(user_shutdown_function_names) = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue