From 051308eadf18067087a1fa8842b010dba17f909f Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Mon, 18 Sep 2006 05:22:11 +0000 Subject: [PATCH] Fix memory leaks in %IF*, %ELIF*, and %UNDEF. NASM SF Bug #852464. Patch by: nasm64developer@yahoo.com svn path=/trunk/yasm/; revision=1620 --- modules/preprocs/nasm/nasm-pp.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/preprocs/nasm/nasm-pp.c b/modules/preprocs/nasm/nasm-pp.c index e41cd93f..518d96d6 100644 --- a/modules/preprocs/nasm/nasm-pp.c +++ b/modules/preprocs/nasm/nasm-pp.c @@ -2270,9 +2270,9 @@ do_directive(Token * tline) { j = if_condition(tline->next, i); tline->next = NULL; /* it got freed */ - free_tlist(origline); j = j < 0 ? COND_NEVER : j ? COND_IF_TRUE : COND_IF_FALSE; } + free_tlist(origline); cond = nasm_malloc(sizeof(Cond)); cond->next = istk->conds; cond->state = j; @@ -2311,12 +2311,12 @@ do_directive(Token * tline) * the normal invocation of expand_mmac_params(). Therefore, * we have to do it explicitly here. */ - j = if_condition(expand_mmac_params(tline->next), i); - tline->next = NULL; /* it got freed */ - free_tlist(origline); + j = if_condition(expand_mmac_params(tline->next), i); + tline->next = NULL; /* it got freed */ istk->conds->state = j < 0 ? COND_NEVER : j ? COND_IF_TRUE : COND_IF_FALSE; } + free_tlist(origline); return DIRECTIVE_FOUND; case PP_ELSE: @@ -2801,8 +2801,6 @@ do_directive(Token * tline) smhead = &ctx->localmac; mname = tline->text; - last = tline; - last->next = NULL; /* * We now have a macro name... go hunt for it. -- 2.40.0