bit more thread safety

One more potential race condition in hashtables
This commit is contained in:
z3APA3A 2015-05-04 18:06:07 +03:00
parent aa4125a6f0
commit bc725189e3
2 changed files with 5 additions and 2 deletions

View File

@ -943,8 +943,11 @@ void hashadd(struct hashtable *ht, const unsigned char* name, unsigned char* val
unsigned index;
if(!value||!name||!ht->hashtable||!ht->hashempty) return;
pthread_mutex_lock(&hash_mutex);
if(!ht||!value||!name||!ht->hashtable||!ht->hashempty) {
pthread_mutex_unlock(&hash_mutex);
return;
}
hen = ht->hashempty;
ht->hashempty = ht->hashempty->next;
nametohash(name, hen->hash, (unsigned char *)ht->rnd);

View File

@ -1,2 +1,2 @@
#define VERSION "3proxy-0.8b-devel"
#define BUILDDATE "150302210600"
#define BUILDDATE "150504180421"