diff options
author | H. Peter Anvin (Intel) <hpa@zytor.com> | 2020-06-08 19:01:05 -0700 |
---|---|---|
committer | H. Peter Anvin (Intel) <hpa@zytor.com> | 2020-06-08 19:01:05 -0700 |
commit | f9f37ddcfeb918420c2b019a56a2b97280f677a8 (patch) | |
tree | e5abbeeb83a2cdcdb66c06d22bfe4c8170cfeb40 /nasmlib | |
parent | bacf04a3e0bd90a1cd6eee665ec0b8a2b162e408 (diff) | |
download | nasm-f9f37ddcfeb918420c2b019a56a2b97280f677a8.tar.gz |
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) <hpa@zytor.com>
Diffstat (limited to 'nasmlib')
-rw-r--r-- | nasmlib/hashtbl.c | 5 |
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); } |