diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2014-06-28 10:17:39 +0400 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2014-06-29 00:52:54 +0400 |
commit | dae24d75047d31e922880d68cac57a61948b010f (patch) | |
tree | 854c064a6a84d132f17021da1af856ee374ff602 | |
parent | c31767c5cbe3bde0648a0aaa9f07cd204cad88d4 (diff) | |
download | nasm-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.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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) |