aboutsummaryrefslogtreecommitdiff
path: root/src/hashmap.c
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-11-10 01:31:46 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-11-10 01:31:46 +0300
commit282914669483405a34000ed24b541201f8d29c4b (patch)
treeb613f8f4844beed5e8109d5c86e80ba872670260 /src/hashmap.c
parent8a5405629f7dcbc2504ac55f57775180a011b846 (diff)
downloadunja-282914669483405a34000ed24b541201f8d29c4b.tar.gz
unja-282914669483405a34000ed24b541201f8d29c4b.zip
hashmap_remove: fix potential use-after-free
prev should be assigned before node is reassigned.
Diffstat (limited to 'src/hashmap.c')
-rw-r--r--src/hashmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hashmap.c b/src/hashmap.c
index 2522907..2787435 100644
--- a/src/hashmap.c
+++ b/src/hashmap.c
@@ -208,8 +208,8 @@ hashmap_remove(struct hashmap *hm, const char *key)
return old_value;
}
- node = node->next;
prev = node;
+ node = node->next;
}
return NULL;