summaryrefslogtreecommitdiff
path: root/main/astfd.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2013-08-20 15:36:10 +0000
committerKinsey Moore <kmoore@digium.com>2013-08-20 15:36:10 +0000
commit63134ea01139b706d1b8e4accf7fecb4b9399f0a (patch)
tree4c97267af33620fa56bc3076966d2b8db46364b0 /main/astfd.c
parented19b8ee76f4f5d51511ba6a99496166a8017cdd (diff)
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 ........ Merged revisions 397107 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397110 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/astfd.c')
-rw-r--r--main/astfd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main/astfd.c b/main/astfd.c
index 3caa135d6..e64177bbc 100644
--- a/main/astfd.c
+++ b/main/astfd.c
@@ -274,8 +274,14 @@ static char *handle_show_fd(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
static struct ast_cli_entry cli_show_fd = AST_CLI_DEFINE(handle_show_fd, "Show open file descriptors");
+static void fd_shutdown(void)
+{
+ ast_cli_unregister(&cli_show_fd);
+}
+
int ast_fd_init(void)
{
+ ast_register_atexit(fd_shutdown);
return ast_cli_register(&cli_show_fd);
}