scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 3e8227a60580f6542a8fccc18fd8716c887ba1b7
parent ab74e508b10e6bdf39ae71e204bf91642257d689
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri,  7 Aug 2015 23:02:14 +0200

Fix realloc size in parameter()

We were passing the number of elements to realloc, and not
the size of the buffer.

Diffstat:
cc1/decl.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -75,7 +75,7 @@ parameter(Symbol *sym, int sclass, Type *data) error("bad storage class in function parameter"); if (n++ == NR_FUNPARAM) error("too much parameters in function definition"); - funtp->pars = xrealloc(funtp->pars, n); + funtp->pars = xrealloc(funtp->pars, n * sizeof(Type *)); funtp->pars[n-1] = tp; funtp->n.elem = n; }