diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2020-02-23 17:23:47 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2020-02-23 20:59:40 +0000 |
commit | 3e02961ec8f21fd656c8b306c5075c0c799df97f (patch) | |
tree | df71a762858a386d557f4c259d3040d6f39cb7e5 /utils | |
parent | 54b1960d18042cf6dfd86cfe01d58455357586d2 (diff) | |
download | netsurf-3e02961ec8f21fd656c8b306c5075c0c799df97f.tar.gz netsurf-3e02961ec8f21fd656c8b306c5075c0c799df97f.tar.bz2 |
utils: Fix destroy of non-empty hashmap
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/hashmap.c | 5 |
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; } } |