aboutsummaryrefslogtreecommitdiff
path: root/lib/darr.c
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-11-01 17:25:33 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-11-01 17:25:33 +0000
commit89fd2b0d17da72aec688946e89eeae4bf196e419 (patch)
treef7890cd9e713809006e5f4cad97fdae79d6b10ed /lib/darr.c
parent0bab4ec014777aa8e409de93ff7d8d4e8fcf490d (diff)
downloadovm-89fd2b0d17da72aec688946e89eeae4bf196e419.tar.gz
ovm-89fd2b0d17da72aec688946e89eeae4bf196e419.tar.bz2
ovm-89fd2b0d17da72aec688946e89eeae4bf196e419.zip
Set any new data allocated to 0 for clarity
This is only new data allocated, so it's a very careful procedure.
Diffstat (limited to 'lib/darr.c')
-rw-r--r--lib/darr.c1
1 files changed, 1 insertions, 0 deletions
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);
}
}