ref: afa3d8514206cb74e453e05d4797bcc7a5151d30
parent: 077fe8de29e1fa78367c241307025781fbd67933
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Mar 10 11:17:33 EST 2023
fix wrong allocations
--- a/cvalues.c
+++ b/cvalues.c
@@ -50,7 +50,7 @@
{
if (nfinalizers == maxfinalizers) {
size_t nn = (maxfinalizers==0 ? 256 : maxfinalizers*2);
- cvalue_t **temp = (cvalue_t**)realloc(Finalizers, nn*sizeof(value_t));
+ cvalue_t **temp = realloc(Finalizers, nn*sizeof(cvalue_t*));
if (temp == NULL)
lerror(MemoryError, "out of memory");
Finalizers = temp;
@@ -893,7 +893,8 @@
value_t cbuiltin(char *name, builtin_t f)
{
- cvalue_t *cv = (cvalue_t*)malloc(CVALUE_NWORDS * sizeof(value_t));
+ cvalue_t *cv;
+ cv = malloc(CVALUE_NWORDS * sizeof(*cv));
cv->type = builtintype;
cv->data = &cv->_space[0];
cv->len = sizeof(value_t);