[asterisk-commits] kmoore: branch 11 r397107 - in /branches/11: ./ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 20 10:27:17 CDT 2013


Author: kmoore
Date: Tue Aug 20 10:27:16 2013
New Revision: 397107

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397107
Log:
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

Modified:
    branches/11/   (props changed)
    branches/11/main/astfd.c
    branches/11/main/threadstorage.c

Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/11/main/astfd.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/astfd.c?view=diff&rev=397107&r1=397106&r2=397107
==============================================================================
--- branches/11/main/astfd.c (original)
+++ branches/11/main/astfd.c Tue Aug 20 10:27:16 2013
@@ -274,8 +274,14 @@
 
 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);
 }
 

Modified: branches/11/main/threadstorage.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/threadstorage.c?view=diff&rev=397107&r1=397106&r2=397107
==============================================================================
--- branches/11/main/threadstorage.c (original)
+++ branches/11/main/threadstorage.c Tue Aug 20 10:27:16 2013
@@ -249,10 +249,16 @@
 	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) */




More information about the asterisk-commits mailing list