[svn-commits] rmudgett: branch 10 r377772 - in /branches/10: ./ main/logger.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Dec 10 20:42:38 CST 2012


Author: rmudgett
Date: Mon Dec 10 20:42:34 2012
New Revision: 377772

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=377772
Log:
Cleanup logger on exit.

* Cleanup CLI commands, destroy verbosers and logchannels lists on exit.

(issue ASTERISK-20649)
Reported by: Corey Farrell
Patches:
      logger-cleanup-all.patch (license #5909) patch uploaded by Corey Farrell
      Modified
........

Merged revisions 377771 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/10/   (props changed)
    branches/10/main/logger.c

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

Modified: branches/10/main/logger.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/logger.c?view=diff&rev=377772&r1=377771&r2=377772
==============================================================================
--- branches/10/main/logger.c (original)
+++ branches/10/main/logger.c Mon Dec 10 20:42:34 2012
@@ -1155,6 +1155,9 @@
 void close_logger(void)
 {
 	struct logchannel *f = NULL;
+	struct verb *cur = NULL;
+
+	ast_cli_unregister_multiple(cli_logger, ARRAY_LEN(cli_logger));
 
 	logger_initialized = 0;
 
@@ -1167,6 +1170,12 @@
 	if (logthread != AST_PTHREADT_NULL)
 		pthread_join(logthread, NULL);
 
+	AST_RWLIST_WRLOCK(&verbosers);
+	while ((cur = AST_LIST_REMOVE_HEAD(&verbosers, list))) {
+		ast_free(cur);
+	}
+	AST_RWLIST_UNLOCK(&verbosers);
+
 	AST_RWLIST_WRLOCK(&logchannels);
 
 	if (qlog) {
@@ -1174,11 +1183,12 @@
 		qlog = NULL;
 	}
 
-	AST_RWLIST_TRAVERSE(&logchannels, f, list) {
+	while ((f = AST_LIST_REMOVE_HEAD(&logchannels, list))) {
 		if (f->fileptr && (f->fileptr != stdout) && (f->fileptr != stderr)) {
 			fclose(f->fileptr);
 			f->fileptr = NULL;
 		}
+		ast_free(f);
 	}
 
 	closelog(); /* syslog */




More information about the svn-commits mailing list