mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
rtp_engine and stun: call ast_register_atexit instead of ast_register_cleanup
rtp_engine.c and stun.c were calling ast_register_cleanup which is skipped if any loadable module can't be cleanly unloaded when asterisk shuts down. Since this will always be the case, their cleanup functions never get run. In a practical sense this makes no difference since asterisk is shutting down but if you're in development mode and trying to use the leak sanitizer, the leaks from both of those modules clutter up the output.
This commit is contained in:
13
main/stun.c
13
main/stun.c
@@ -576,8 +576,17 @@ static void stun_shutdown(void)
|
||||
void ast_stun_init(void)
|
||||
{
|
||||
ast_cli_register_multiple(cli_stun, sizeof(cli_stun) / sizeof(struct ast_cli_entry));
|
||||
ast_register_cleanup(stun_shutdown);
|
||||
|
||||
debug_category_stun_id = ast_debug_category_register(AST_LOG_CATEGORY_STUN);
|
||||
debug_category_stun_packet_id = ast_debug_category_register(AST_LOG_CATEGORY_STUN_PACKET);
|
||||
|
||||
/*
|
||||
* Normnally a core module should call ast_register_cleanup
|
||||
* which doesn't run if any module fails to unload. This
|
||||
* prevents resources being pulled out from under a running
|
||||
* module and ppossibly causing a segfault. In this case however,
|
||||
* the only thing we're cleaning up is the cli command and
|
||||
* the registers of the debug categories.
|
||||
*/
|
||||
ast_register_atexit(stun_shutdown);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user