diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-04-08 13:37:57 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-04-08 13:37:57 -0400 |
commit | 99c2bfe76b48f8a142682c2729236d5e4e63ec25 (patch) | |
tree | 098890cdffda2fd318bfc5fecf4c348fa8ad1202 /src/common/log.c | |
parent | 85ac832a1474e274ff4a6ad9444cf5e0ab12450e (diff) | |
parent | e247705afefaa0f32ccbc43185f98fc65f041af1 (diff) | |
download | tor-99c2bfe76b48f8a142682c2729236d5e4e63ec25.tar.gz tor-99c2bfe76b48f8a142682c2729236d5e4e63ec25.zip |
Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts:
src/or/rephist.c
Diffstat (limited to 'src/common/log.c')
-rw-r--r-- | src/common/log.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/common/log.c b/src/common/log.c index a073c827e0..0224e33319 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -382,7 +382,7 @@ logv(int severity, log_domain_mask_t domain, const char *funcname, continue; } else if (lf->callback) { if (domain & LD_NOCB) { - if (!callbacks_deferred) { + if (!callbacks_deferred && pending_cb_messages) { pending_cb_message_t *msg = tor_malloc(sizeof(pending_cb_message_t)); msg->severity = severity; msg->domain = domain; @@ -531,9 +531,12 @@ void logs_free_all(void) { logfile_t *victim, *next; + smartlist_t *messages; LOCK_LOGS(); next = logfiles; logfiles = NULL; + messages = pending_cb_messages; + pending_cb_messages = NULL; UNLOCK_LOGS(); while (next) { victim = next; @@ -543,6 +546,12 @@ logs_free_all(void) } tor_free(appname); + SMARTLIST_FOREACH(messages, pending_cb_message_t *, msg, { + tor_free(msg->msg); + tor_free(msg); + }); + smartlist_free(messages); + /* We _could_ destroy the log mutex here, but that would screw up any logs * that happened between here and the end of execution. */ } |