diff --git a/src/modules/HTTPLoop/accept_and_parse.c b/src/modules/HTTPLoop/accept_and_parse.c index 47175d395675de5afde39f4bad2d71d0fa3ba57a..aab4d65687587cb7fb715acbfab197e67c3f3299 100644 --- a/src/modules/HTTPLoop/accept_and_parse.c +++ b/src/modules/HTTPLoop/accept_and_parse.c @@ -461,6 +461,20 @@ static void low_accept_loop(struct args *arg) struct cache *c, *p = NULL; struct log *l, *n = NULL; /* oups. */ + + /* NB: log_head is protected by the log_lock mutex. */ + mt_lock(&arg->log->log_lock); + while(arg->log->log_head) + { + struct log_entry *l = arg->log->log_head->next; + free(arg->log->log_head); + arg->log->log_head = l; + } + mt_unlock(&arg->log->log_lock); + + /* NB: The cache, and the variables first_cache and aap_first_log + * are protected by the interpreter lock. + */ low_mt_lock_interpreter(); /* Can run even if threads_disabled. */ for(i=0; i<CACHE_HTABLE_SIZE; i++) { @@ -475,12 +489,6 @@ static void low_accept_loop(struct args *arg) free(t); } } - while(arg->log->log_head) - { - struct log_entry *l = arg->log->log_head->next; - free(arg->log->log_head); - arg->log->log_head = l; - } c = first_cache; while(c && c != arg->cache) {p=c;c = c->next;}