mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-10 03:48:34 +00:00
Unregister CLI commands on exit
This patch ensures that CLI commands enabled by DEBUG_FD_LEAKS and
DEBUG_THREADLOCALS are cleaned up properly on exit.
(closes issue ASTERISK-22238)
Reported by: Corey Farrell
Tested by: Corey Farrell
Patches:
debug_cli_unregister.patch uploaded by Corey Farrell
........
Merged revisions 397106 from http://svn.asterisk.org/svn/asterisk/branches/1.8
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@397107 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -249,10 +249,16 @@ static struct ast_cli_entry cli[] = {
|
||||
AST_CLI_DEFINE(handle_cli_threadstorage_show_summary, "Summarize outstanding memory allocations")
|
||||
};
|
||||
|
||||
static void threadstorage_shutdown(void)
|
||||
{
|
||||
ast_cli_unregister_multiple(cli, ARRAY_LEN(cli));
|
||||
}
|
||||
|
||||
void threadstorage_init(void)
|
||||
{
|
||||
pthread_mutex_init(&threadstoragelock, NULL);
|
||||
ast_cli_register_multiple(cli, ARRAY_LEN(cli));
|
||||
ast_register_atexit(threadstorage_shutdown);
|
||||
}
|
||||
|
||||
#endif /* !defined(DEBUG_THREADLOCALS) */
|
||||
|
||||
Reference in New Issue
Block a user