shithub: scc

Download patch

ref: d691713e7dd054277bf83dc26b0b1d2a92fd5409
parent: 743db5c26f0173ca447f0de8533c14abdd79f0da
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Aug 14 03:44:22 EDT 2015

Avoid segmentation fault in mktype()

When mktype detects that the new type was already created
it tries to free the parameter received, so it is very
important that this parameter must to have a correct
value.

--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -42,9 +42,11 @@
 	va_start(va, op);
 	if ((n = dp->nr++) == NR_DECLARATORS)
 		error("too much declarators");
-	p = &dp->d[n];
 
+	p = &dp->d[n];
 	p->op = op;
+	p->tpars = NULL;
+
 	switch (op) {
 	case ARY:
 		p->nelem = va_arg(va, unsigned);