advent2021

Advent of Code 2021 Solutions
git clone git://bsandro.tech/advent2021
Log | Files | Refs

commit 6eaa7994d753e265e3c67e9890db44f5ddbf0ee8
parent 4406f03bfb6726439fa6aa60c7e93ac62b5b5878
Author: bsandro <[email protected]>
Date:   Sat,  4 Dec 2021 14:52:41 +0200

reallocf -> realloc+free

Diffstat:
Mday03/puzzle2.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/day03/puzzle2.c b/day03/puzzle2.c @@ -67,9 +67,10 @@ int puzzle2(const char *filename) { // just a precaution, good 'ole "allocate x2 if it doesn't fit anymore" if (numbers.count >= numbers.limit) { numbers.limit *= 2; - numbers.data = reallocf(numbers.data, numbers.limit * sizeof(long)); + numbers.data = realloc(numbers.data, numbers.limit * sizeof(long)); if (numbers.data == NULL) { - PRINT_ERR(reallocf) + free(numbers.data); + PRINT_ERR(realloc) return -1; } }