From d4da5d79bf0c494fec918508f461cc5f18a0d73c Mon Sep 17 00:00:00 2001 From: Jonathan Rose <jrose@digium.com> Date: Thu, 24 Oct 2013 19:28:10 +0000 Subject: [PATCH] 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) ........ Merged revisions 401781 from http://svn.asterisk.org/svn/asterisk/branches/1.8 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@401783 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/astobj2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main/astobj2.c b/main/astobj2.c index a9e0d7a361..35dd17172e 100644 --- a/main/astobj2.c +++ b/main/astobj2.c @@ -1710,12 +1710,18 @@ static struct ast_cli_entry cli_astobj2[] = { AST_CLI_DEFINE(handle_astobj2_stats, "Print astobj2 statistics"), 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 */ int astobj2_init(void) { #ifdef AO2_DEBUG ast_cli_register_multiple(cli_astobj2, ARRAY_LEN(cli_astobj2)); + ast_register_atexit(astobj2_cleanup); #endif return 0; -- GitLab