Explorar el Código

avoid potential race condition on configuration reload

z3APA3A hace 10 años
padre
commit
206e00c933
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      src/auth.c

+ 4 - 1
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);