diff --git a/main/astfd.c b/main/astfd.c index 3caa135d63..e64177bbcf 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); } diff --git a/main/threadstorage.c b/main/threadstorage.c index c89d1078d0..349cb4ecdf 100644 --- a/main/threadstorage.c +++ b/main/threadstorage.c @@ -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) */