Index: asterisk.c =================================================================== RCS file: /usr/cvsroot/asterisk/asterisk.c,v retrieving revision 1.91 diff -u -4 -p -b -r1.91 asterisk.c --- asterisk.c 13 Jun 2004 21:25:09 -0000 1.91 +++ asterisk.c 15 Jun 2004 19:09:57 -0000 @@ -584,8 +584,12 @@ static void quit_handler(int num, int ni } if (option_verbose || option_console) ast_verbose("Restarting Asterisk NOW...\n"); restartnow = 1; + + /* close logger */ + close_logger(); + /* If there is a consolethread running send it a SIGHUP so it can execvp, otherwise we can do it ourselves */ if (consolethread != AST_PTHREADT_NULL) { pthread_kill(consolethread, SIGHUP); @@ -593,8 +597,11 @@ static void quit_handler(int num, int ni sleep(2); } else execvp(_argv[0], _argv); + } else { + /* close logger */ + close_logger(); } exit(0); } Index: logger.c =================================================================== RCS file: /usr/cvsroot/asterisk/logger.c,v retrieving revision 1.37 diff -u -4 -p -b -r1.37 logger.c --- logger.c 9 Jun 2004 01:45:07 -0000 1.37 +++ logger.c 15 Jun 2004 19:09:58 -0000 @@ -429,8 +429,27 @@ int init_logger(void) init_logger_chain(); return -1; } +void close_logger(void) +{ + struct msglist *m, *tmp; + + m = list; + ast_mutex_lock(&msglist_lock); + while(m) { + if (m->msg) { + free(m->msg); + } + tmp = m->next; + free(m); + m = tmp; + } + list = last = NULL; + ast_mutex_unlock(&msglist_lock); + return; +} + static void ast_log_vsyslog(int level, const char *file, int line, const char *function, const char *fmt, va_list args) { char buf[BUFSIZ]; if(level >= SYSLOG_NLEVELS) { Index: asterisk.h =================================================================== RCS file: /usr/cvsroot/asterisk/asterisk.h,v retrieving revision 1.11 diff -u -4 -p -b -r1.11 asterisk.h --- asterisk.h 26 Nov 2003 22:00:07 -0000 1.11 +++ asterisk.h 15 Jun 2004 19:09:58 -0000 @@ -39,8 +39,9 @@ extern int load_modules(void); /* Provided by pbx.c */ extern int load_pbx(void); /* Provided by logger.c */ extern int init_logger(void); +extern void close_logger(void); /* Provided by frame.c */ extern int init_framer(void); /* Provided by logger.c */ extern int reload_logger(int);