scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit a1db98fafab9e5f348a1a1e16564caad4fb59f52
parent 734448b3325cec5c59a3ecc611a524a9719c4c75
Author: Pekka Jylhä-Ollila <pekka.jylha.ollila@gmail.com>
Date:   Tue, 12 Apr 2016 07:46:13 +0200

[cc2]Fix segmentation fault in writeout function

This patch fixes a segfault when more than one function is
defined in the IR input.

Diffstat:
Mcc2/node.c | 2+-
Mcc2/parser.c | 1+
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/cc2/node.c b/cc2/node.c @@ -69,7 +69,7 @@ cleannodes(void) struct arena *ap, *next; for (ap = arena; ap; ap = next) { - next = ap; + next = ap->next; free(ap->mem); free(ap); } diff --git a/cc2/parser.c b/cc2/parser.c @@ -629,6 +629,7 @@ parse(void) cleannodes(); /* remove code of previous function */ popctx(); /* remove context of previous function */ curfun = NULL; + endf = 0; while (!endf && nextline()) /* nothing */;