mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
Free pending_cb_messages on exit
This commit is contained in:
parent
403b6cfded
commit
1be1221385
@ -363,7 +363,7 @@ logv(int severity, log_domain_mask_t domain, const char *funcname,
|
|||||||
continue;
|
continue;
|
||||||
} else if (lf->callback) {
|
} else if (lf->callback) {
|
||||||
if (domain & LD_NOCB) {
|
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));
|
pending_cb_message_t *msg = tor_malloc(sizeof(pending_cb_message_t));
|
||||||
msg->severity = severity;
|
msg->severity = severity;
|
||||||
msg->domain = domain;
|
msg->domain = domain;
|
||||||
@ -512,9 +512,12 @@ void
|
|||||||
logs_free_all(void)
|
logs_free_all(void)
|
||||||
{
|
{
|
||||||
logfile_t *victim, *next;
|
logfile_t *victim, *next;
|
||||||
|
smartlist_t *messages;
|
||||||
LOCK_LOGS();
|
LOCK_LOGS();
|
||||||
next = logfiles;
|
next = logfiles;
|
||||||
logfiles = NULL;
|
logfiles = NULL;
|
||||||
|
messages = pending_cb_messages;
|
||||||
|
pending_cb_messages = NULL;
|
||||||
UNLOCK_LOGS();
|
UNLOCK_LOGS();
|
||||||
while (next) {
|
while (next) {
|
||||||
victim = next;
|
victim = next;
|
||||||
@ -524,6 +527,12 @@ logs_free_all(void)
|
|||||||
}
|
}
|
||||||
tor_free(appname);
|
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
|
/* We _could_ destroy the log mutex here, but that would screw up any logs
|
||||||
* that happened between here and the end of execution. */
|
* that happened between here and the end of execution. */
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user