summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index ab17433..19d6c18 100644
--- a/hash.c
+++ b/hash.c
@@ -87,6 +87,7 @@ void *hash_read(struct hash *h, void *key, uint32_t keylen) {
void *hash_extract(struct hash *h, void *key, uint32_t keylen) {
struct list_node *ln;
struct hash_entry *e;
+ void *data;
if (!h)
return 0;
@@ -96,9 +97,10 @@ void *hash_extract(struct hash *h, void *key, uint32_t keylen) {
if (e->keylen == keylen && !memcmp(e->key, key, keylen)) {
free(e->key);
list_removedata(h->hashlist, e);
+ data = e->data;
free(e);
pthread_mutex_unlock(&h->mutex);
- return e->data;
+ return data;
}
}
pthread_mutex_unlock(&h->mutex);