From: Peter Johnson Date: Thu, 2 Oct 2003 03:53:53 +0000 (-0000) Subject: Separate decrement and nasm_free() call; with dmalloc enabled, nasm_free() X-Git-Tag: v0.4.0~106 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=18b2af8355f76ea9fb1c883488d4ca8046766453;p=yasm Separate decrement and nasm_free() call; with dmalloc enabled, nasm_free() is a macro (in the yasm version) that uses the passed pointer twice. svn path=/trunk/yasm/; revision=1057 --- diff --git a/modules/preprocs/nasm/nasm-eval.c b/modules/preprocs/nasm/nasm-eval.c index eb1cea83..333af297 100644 --- a/modules/preprocs/nasm/nasm-eval.c +++ b/modules/preprocs/nasm/nasm-eval.c @@ -52,8 +52,10 @@ static long abs_offset = 0; /* ABSOLUTE segment offset */ */ void nasm_eval_cleanup(void) { - while (ntempexprs) - nasm_free (tempexprs[--ntempexprs]); + while (ntempexprs) { + ntempexprs--; + nasm_free (tempexprs[ntempexprs]); + } nasm_free (tempexprs); } @@ -782,8 +784,10 @@ nasm_expr *nasm_evaluate (scanner sc, void *scprivate, struct tokenval *tv, else i = tokval->t_type; - while (ntempexprs) /* initialise temporary storage */ - nasm_free (tempexprs[--ntempexprs]); + while (ntempexprs) { /* initialise temporary storage */ + ntempexprs--; + nasm_free (tempexprs[ntempexprs]); + } e = bexpr (critical); if (!e)