utils: Fix destroy of non-empty hashmap

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
Daniel Silverstone 2020-02-23 17:23:47 +00:00
parent 54b1960d18
commit 3e02961ec8
No known key found for this signature in database
GPG Key ID: C30DF439F2987D74

View File

@ -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;
}
}