diff --git a/asm/preproc.c b/asm/preproc.c index 0030959e..3fb9e01f 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -7076,7 +7076,7 @@ static int expand_mmacro(Token * tline) */ nasm_newn(paramlen, nparam+1); - for (i = 1; (t = params[i]); i++) { + for (i = 1; i < nparam+1 && (t = params[i]); i++) { bool braced = false; int brace = 0; int white = 0; diff --git a/nasmlib/alloc.c b/nasmlib/alloc.c index e25e0e0a..df2e02b4 100644 --- a/nasmlib/alloc.c +++ b/nasmlib/alloc.c @@ -104,8 +104,10 @@ void *nasm_realloc(void *q, size_t size) void nasm_free(void *q) { - if (q) + if (q){ free(q); + q = NULL; + } } char *nasm_strdup(const char *s)