From f9f37ddcfeb918420c2b019a56a2b97280f677a8 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin (Intel)" Date: Mon, 8 Jun 2020 19:01:05 -0700 Subject: hashtbl.c: don't call nasm_free() for a null pointer There really isn't much point in calling nasm_free() everywhere, even with a null pointer... Signed-off-by: H. Peter Anvin (Intel) --- nasmlib/hashtbl.c | 5 +++-- 1 file 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); } -- cgit v1.2.1