From 89fd2b0d17da72aec688946e89eeae4bf196e419 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 1 Nov 2023 17:25:33 +0000 Subject: Set any new data allocated to 0 for clarity This is only new data allocated, so it's a very careful procedure. --- lib/darr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/darr.c b/lib/darr.c index 9700701..d9a8645 100644 --- a/lib/darr.c +++ b/lib/darr.c @@ -34,6 +34,7 @@ void darr_ensure_capacity(darr_t *darr, size_t requested) darr->available = MAX(darr->used + requested, darr->available * DARR_REALLOC_MULT); darr->data = realloc(darr->data, darr->available); + memset(darr->data + darr->used, 0, darr->available - darr->used); } } -- cgit v1.2.3-13-gbd6f