summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2014-06-28 10:17:39 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2014-06-29 00:52:54 +0400
commitdae24d75047d31e922880d68cac57a61948b010f (patch)
tree854c064a6a84d132f17021da1af856ee374ff602
parentc31767c5cbe3bde0648a0aaa9f07cd204cad88d4 (diff)
downloadnasm-dae24d75047d31e922880d68cac57a61948b010f.tar.gz
preproc: pp_cleanup -- Don't forget to zeroify variables
Once we free allocated memory don't forget to setup variables to NULL, otherwise they are pointing into nonexisting memory, which might lead into sigsegv in best case. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--preproc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/preproc.c b/preproc.c
index 9b114c2e..12b39782 100644
--- a/preproc.c
+++ b/preproc.c
@@ -1184,6 +1184,7 @@ static void delete_Blocks(void)
if (a != &blocks)
nasm_free(a);
}
+ memset(&blocks, 0, sizeof(blocks));
}
/*
@@ -5141,7 +5142,9 @@ static void pp_cleanup(int pass)
if (pass == 0) {
IncPath *i;
free_llist(predef);
+ predef = NULL;
delete_Blocks();
+ freeTokens = NULL;
while ((i = ipath)) {
ipath = i->next;
if (i->path)