summaryrefslogtreecommitdiff
path: root/nasmlib/strlist.c
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-13 22:58:35 -0800
committerH. Peter Anvin (Intel) <hpa@zytor.com>2018-12-13 22:59:50 -0800
commit6ddc62fbab50002efe6fa137d8fa7ceba0005948 (patch)
treeb8f544994d3aeeb22ac6b17facaa3e0295325a54 /nasmlib/strlist.c
parent7dc5b2392021e39050187216613b474c51ed5765 (diff)
downloadnasm-6ddc62fbab50002efe6fa137d8fa7ceba0005948.tar.gz
strlist: make sure strlist_free() works for a non-uniqizing list too
We can't rely on hash_free_all() when using a non-uniqizing list. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'nasmlib/strlist.c')
-rw-r--r--nasmlib/strlist.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/nasmlib/strlist.c b/nasmlib/strlist.c
index 7518982a..93a6787f 100644
--- a/nasmlib/strlist.c
+++ b/nasmlib/strlist.c
@@ -141,7 +141,14 @@ strlist_printf(struct strlist *list, const char *fmt, ...)
void strlist_free(struct strlist *list)
{
if (list) {
- hash_free_all(&list->hash, false);
+ struct strlist_entry *e, *tmp;
+
+ if (list->uniq)
+ hash_free(&list->hash);
+
+ list_for_each_safe(e, tmp, list->head)
+ nasm_free(e);
+
nasm_free(list);
}
}