aboutsummaryrefslogtreecommitdiffstats
path: root/nasmlib/hashtbl.c
diff options
context:
space:
mode:
Diffstat (limited to 'nasmlib/hashtbl.c')
-rw-r--r--nasmlib/hashtbl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/nasmlib/hashtbl.c b/nasmlib/hashtbl.c
index 3f4a957c..9a4c0b55 100644
--- a/nasmlib/hashtbl.c
+++ b/nasmlib/hashtbl.c
@@ -277,8 +277,9 @@ void hash_free_all(struct hash_table *head, bool free_keys)
const struct hash_node *np;
hash_for_each(head, it, np) {
- nasm_free(np->data);
- if (free_keys)
+ if (np->data)
+ nasm_free(np->data);
+ if (free_keys && np->key)
nasm_free((void *)np->key);
}