scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit d691713e7dd054277bf83dc26b0b1d2a92fd5409
parent 743db5c26f0173ca447f0de8533c14abdd79f0da
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 14 Aug 2015 07:44:22 +0200

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.

Diffstat:
Mcc1/decl.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -42,9 +42,11 @@ push(struct declarators *dp, unsigned op, ...) 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);