From 206e00c933815d5d9976e9773b9280f15e18100e Mon Sep 17 00:00:00 2001 From: z3APA3A <3APA3A@3proxy.ru> Date: Wed, 16 Sep 2015 00:54:34 +0300 Subject: [PATCH] avoid potential race condition on configuration reload --- src/auth.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/auth.c b/src/auth.c index 98d5724..177a526 100644 --- a/src/auth.c +++ b/src/auth.c @@ -961,8 +961,11 @@ void hashadd(struct hashtable *ht, const unsigned char* name, unsigned long valu struct hashentry * he; unsigned index; - if(!value||!name||!ht->hashtable||!ht->hashempty) return; pthread_mutex_lock(&hash_mutex); + if(!value||!name||!ht->hashtable||!ht->hashempty){ + pthread_mutex_unlock(&hash_mutex); + return; + } he = ht->hashempty; ht->hashempty = ht->hashempty->next; nametohash(name, he->hash);