commit 3e8227a60580f6542a8fccc18fd8716c887ba1b7
Author: Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Fri Aug 7 23:02:14 2015 +0200
Commit: Roberto E. Vargas Caballero <[email protected]>
CommitDate: Fri Aug 7 23:02:14 2015 +0200
Fix realloc size in parameter()
We were passing the number of elements to realloc, and not
the size of the buffer.
diff --git a/cc1/decl.c b/cc1/decl.c
index c8c96f1..6fdad29 100644
--- 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;
}