diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-06-27 15:54:25 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-06-27 15:54:25 -0700 |
commit | eac7892834d5060030133a22edae6b3ee68c76d8 (patch) | |
tree | d7d0e0055bd84de191ab9d5cad3b6227da001c20 /hashtbl.c | |
parent | f7a9ecaffad2b8dea7171ebac16fe9703d1b58e1 (diff) | |
download | nasm-eac7892834d5060030133a22edae6b3ee68c76d8.tar.gz nasm-eac7892834d5060030133a22edae6b3ee68c76d8.tar.bz2 nasm-eac7892834d5060030133a22edae6b3ee68c76d8.zip |
hashtbl: make hash_iterate() not crash on an uninitalized table
Trying to walk an uninitialized table (->table == NULL) should just
return nothing. This can happen due when pp_cleanup() is called after
a failure.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'hashtbl.c')
-rw-r--r-- | hashtbl.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -156,8 +156,11 @@ void *hash_iterate(const struct hash_table *head, struct hash_tbl_node *np = *iterator; struct hash_tbl_node *ep = head->table + head->size; - if (!np) + if (!np) { np = head->table; + if (!np) + return NULL; /* Uninitialized table */ + } while (np < ep) { if (np->key) { |