diff --git a/asm/preproc.c b/asm/preproc.c index ac42131e9..3649c53df 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -3318,6 +3318,7 @@ static bool parse_mmacro_spec(Token *tline, MMacro *def, const char *directive) #if 0 def->prev = NULL; #endif + nasm_assert(!def->name); def->name = dup_text(tline); def->plus = false; def->nolist = 0; @@ -4615,12 +4616,14 @@ static int do_directive(Token *tline, Token **output) if (!mmac_p) { /* No such macro */ free_tlist(spec.dlist); + nasm_free(spec.name); break; } /* Check the macro to be undefined is not being expanded */ list_for_each(l, istk->expansion) { if (l->finishes == *mmac_p) { + nasm_free(spec.name); nasm_nonfatal("`%%unmacro' can't undefine the macro being expanded"); /* * Do not release the macro instance to avoid using the freed @@ -4644,6 +4647,7 @@ static int do_directive(Token *tline, Token **output) } } free_tlist(spec.dlist); + nasm_free(spec.name); break; }