From f52477731328919e33abb29d2094640507a3fb24 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Tue, 30 Jan 2024 16:27:17 +0100 Subject: [PATCH] switch to using calloc (initializes memory to zero) --- squiggle_more.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squiggle_more.c b/squiggle_more.c index a42352b..eceb37e 100644 --- a/squiggle_more.c +++ b/squiggle_more.c @@ -225,7 +225,7 @@ void array_print_histogram(double* xs, int n_samples, int n_bins) { return; } - int *bins = (int*) malloc((size_t)n_bins * sizeof(int)); + int *bins = (int*) calloc((size_t)n_bins, sizeof(int)); if (bins == NULL) { fprintf(stderr, "Memory allocation for bins failed.\n"); return;