mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-04-12 18:40:23 +08:00
preproc.c: fix the loop in %undef
The parent-pointer-based freeing loop in %undef should not advance the parent pointer when a node is freed, since that will result accessing freed memory.
This commit is contained in:
parent
82f9f63378
commit
e373efdab5
@ -2438,13 +2438,15 @@ static int do_directive(Token * tline)
|
||||
/*
|
||||
* We now have a macro name... go hunt for it.
|
||||
*/
|
||||
for (sp = smhead; *sp; sp = &(*sp)->next) {
|
||||
s = *sp;
|
||||
sp = smhead;
|
||||
while ((s = *sp) != NULL) {
|
||||
if (!mstrcmp(s->name, tline->text, s->casesense)) {
|
||||
*sp = s->next;
|
||||
nasm_free(s->name);
|
||||
free_tlist(s->expansion);
|
||||
nasm_free(s);
|
||||
} else {
|
||||
sp = &s->next;
|
||||
}
|
||||
}
|
||||
free_tlist(origline);
|
||||
|
Loading…
x
Reference in New Issue
Block a user