diff --git a/output/codeview.c b/output/codeview.c index f424bec66..d5c4ebf75 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -306,7 +306,7 @@ static void build_type_table(struct coff_Section *const sect); static void cv8_cleanup(void) { struct cv8_symbol *sym; - struct source_file *file; + struct source_file *file, *filetmp; struct coff_Section *symbol_sect = coff_sects[cv8_state.symbol_sect]; struct coff_Section *type_sect = coff_sects[cv8_state.type_sect]; @@ -317,7 +317,7 @@ static void cv8_cleanup(void) build_symbol_table(symbol_sect); build_type_table(type_sect); - list_for_each(file, cv8_state.source_files) { + list_for_each_safe(file, filetmp, cv8_state.source_files) { nasm_free(file->fullname); saa_free(file->lines); free(file);