mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-27 08:10:07 +08:00
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>
This commit is contained in:
parent
bacf04a3e0
commit
f9f37ddcfe
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user