summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-04-11 19:41:00 +0200
committerPaweł Redman <pawel.redman@gmail.com>2017-04-11 19:41:00 +0200
commit85ecf73037f74bc798429a1a989e9a2ac6227ca7 (patch)
tree95b5c9952170cfa9ddfb72b9455e9227f55f0c71
parent03d33627e9341cc161c459d4a557c547cade28af (diff)
Remove a potential race condition in database code.
-rw-r--r--src/database.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/database.c b/src/database.c
index 886c9a4..b3ffb7f 100644
--- a/src/database.c
+++ b/src/database.c
@@ -83,8 +83,10 @@ void db_destroy(void)
for (entry = database[i]; entry; entry = next) {
next = entry->ht_chain.next;
+ pthread_mutex_lock(&entry->mutex);
free(entry->revdns.data);
free(entry->whois.data);
+ pthread_mutex_unlock(&entry->mutex);
destroy_entry(entry);
}