[nasm:nasm-2.16.xx] BR 3392892: fix memory leak related to BR 3392414
nasm-bot for C. Masloch
pushbx at ulukai.org
Wed Oct 11 14:00:07 PDT 2023
Commit-ID: d48839780d9060d4bf8cff9851c837b89302c194
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=d48839780d9060d4bf8cff9851c837b89302c194
Author: C. Masloch <pushbx at ulukai.org>
AuthorDate: Wed, 11 Oct 2023 13:57:04 -0700
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Wed, 11 Oct 2023 13:58:48 -0700
BR 3392892: fix memory leak related to BR 3392414
The fix for BR 3392414 introduced a fairly serious memory
leak. C. Masloch was kind enough to track down the proper root cause
and fix it correctly.
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
asm/preproc.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/asm/preproc.c b/asm/preproc.c
index ac42131e..055f18b8 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -7640,10 +7640,12 @@ static Token *pp_tokline(void)
#endif
{
nasm_free(m->params);
+ nasm_free(m->iname);
free_tlist(m->iline);
nasm_free(m->paramlen);
fm->in_progress = 0;
m->params = NULL;
+ m->iname = NULL;
m->iline = NULL;
m->paramlen = NULL;
}
@@ -7667,16 +7669,8 @@ static Token *pp_tokline(void)
istk->where = l->where;
- /*
- * FIXME It is incorrect to always free_mmacro here.
- * It leads to usage-after-free.
- *
- * https://bugzilla.nasm.us/show_bug.cgi?id=3392414
- */
-#if 0
- else
+ if (!m->name)
free_mmacro(m);
-#endif
}
istk->expansion = l->next;
nasm_free(l);
More information about the Nasm-commits
mailing list