mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 10:35:40 +08:00
bit more thread safety
One more potential race condition in hashtables
This commit is contained in:
parent
aa4125a6f0
commit
bc725189e3
@ -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);
|
||||
|
@ -1,2 +1,2 @@
|
||||
#define VERSION "3proxy-0.8b-devel"
|
||||
#define BUILDDATE "150302210600"
|
||||
#define BUILDDATE "150504180421"
|
||||
|
Loading…
Reference in New Issue
Block a user