mirror of
https://github.com/netwide-assembler/nasm
synced 2026-08-26 16:23:04 -04: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
1 changed files with 3 additions and 2 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue