summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2020-02-23 17:23:47 +0000
committerDaniel Silverstone <dsilvers@digital-scurf.org>2020-02-23 20:59:40 +0000
commit3e02961ec8f21fd656c8b306c5075c0c799df97f (patch)
treedf71a762858a386d557f4c259d3040d6f39cb7e5
parent54b1960d18042cf6dfd86cfe01d58455357586d2 (diff)
downloadnetsurf-3e02961ec8f21fd656c8b306c5075c0c799df97f.tar.gz
netsurf-3e02961ec8f21fd656c8b306c5075c0c799df97f.tar.bz2
utils: Fix destroy of non-empty hashmap
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
-rw-r--r--utils/hashmap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/utils/hashmap.c b/utils/hashmap.c
index bfbf6ceb8..b7870a3a7 100644
--- a/utils/hashmap.c
+++ b/utils/hashmap.c
@@ -85,11 +85,12 @@ hashmap_destroy(hashmap_t *hashmap)
for (bucket = 0; bucket < hashmap->bucket_count; bucket++) {
for (entry = hashmap->buckets[bucket];
- entry != NULL;
- entry = entry->next) {
+ entry != NULL;) {
+ hashmap_entry_t *next = entry->next;
hashmap->params->value_destroy(entry->value);
hashmap->params->key_destroy(entry->key);
free(entry);
+ entry = next;
}
}