astobj2: Unregister debug CLI commands at exit

(issue ASTERISK-22467)
Reported by: Corey Farrell
Patches:
    astobj2-clean-debug-cli-1.8-11.patch uploaded by coreyfarrell (license 5909)
    astobj2-clean-debug-cli-12up.patch uploaded by coreyfarrell (license 5909)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@401781 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jonathan Rose
2013-10-24 19:26:47 +00:00
parent 76428d4e12
commit 49716f1f8c

View File

@@ -1127,12 +1127,18 @@ static struct ast_cli_entry cli_astobj2[] = {
AST_CLI_DEFINE(handle_astobj2_stats, "Print astobj2 statistics"), AST_CLI_DEFINE(handle_astobj2_stats, "Print astobj2 statistics"),
AST_CLI_DEFINE(handle_astobj2_test, "Test astobj2"), AST_CLI_DEFINE(handle_astobj2_test, "Test astobj2"),
}; };
static void astobj2_cleanup(void)
{
ast_cli_unregister_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2));
}
#endif /* AO2_DEBUG */ #endif /* AO2_DEBUG */
int astobj2_init(void) int astobj2_init(void)
{ {
#ifdef AO2_DEBUG #ifdef AO2_DEBUG
ast_cli_register_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2)); ast_cli_register_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2));
ast_register_atexit(astobj2_cleanup);
#endif #endif
return 0; return 0;