Fix verbose logger queue so that list doesnt get touched without msglist_lock being...
authorJames Golovich <james@gnuinter.net>
Tue, 28 Sep 2004 21:13:50 +0000 (21:13 +0000)
committerJames Golovich <james@gnuinter.net>
Tue, 28 Sep 2004 21:13:50 +0000 (21:13 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3851 65c4cc65-6c06-0410-ace0-fbb531ad65f3

logger.c

index 25bf5d3..683c186 100755 (executable)
--- a/logger.c
+++ b/logger.c
@@ -455,8 +455,8 @@ void close_logger(void)
 {
        struct msglist *m, *tmp;
 
-       m = list;
        ast_mutex_lock(&msglist_lock);
+       m = list;
        while(m) {
                if (m->msg) {
                        free(m->msg);
@@ -656,8 +656,8 @@ extern void ast_verbose(const char *fmt, ...)
 int ast_verbose_dmesg(void (*v)(const char *string, int opos, int replacelast, int complete))
 {
        struct msglist *m;
-       m = list;
        ast_mutex_lock(&msglist_lock);
+       m = list;
        while(m) {
                /* Send all the existing entries that we have queued (i.e. they're likely to have missed) */
                v(m->msg, 0, 0, 1);