ref: a91cab7bce37b82534ee3f59c8fed4e270dd919a
parent: e130d49e620f3a806cd4f262f623bdfda985adf4
author: Pekka Jylhä-Ollila <pekka.jylha.ollila@gmail.com>
date: Tue Apr 12 03:46:13 EDT 2016
[cc2]Fix segmentation fault in writeout function This patch fixes a segfault when more than one function is defined in the IR input.
--- a/cc2/node.c
+++ b/cc2/node.c
@@ -69,7 +69,7 @@
struct arena *ap, *next;
for (ap = arena; ap; ap = next) {
- next = ap;
+ next = ap->next;
free(ap->mem);
free(ap);
}
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -629,6 +629,7 @@
cleannodes(); /* remove code of previous function */
popctx(); /* remove context of previous function */
curfun = NULL;
+ endf = 0;
while (!endf && nextline())
/* nothing */;
--
⑨