mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
bit more thread safety
One more potential race condition in hashtables
This commit is contained in:
1 parent
aa4125a6f0
commit
bc725189e3
2 files changed
+5
-2
No files matched your search
+4
-1
@@ -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
-1
@@ -1,2 +1,2 @@
|
||||
#define VERSION "3proxy-0.8b-devel"
|
||||
#define BUILDDATE "150302210600"
|
||||
#define BUILDDATE "150504180421"
|
||||
Reference in new issue
Block a user