From b7a688ad0c31a4abf47c5bd27dc9b4cce6b035b4 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 21 Oct 2025 15:19:24 -0400 Subject: [PATCH] Properly initalize counts array The writeread test was producing wildly inconsistent results on windows. Problem turned out to be the allocation of the counts array, which by some stroke of luck seems to always get a buffer full of zeros on most platforms...except for windows which more frequently gets whatever garbage is on the heap at the allocated location. This in turn leads to count values that start at some huge number and goes up from there, leading to 0 average per call run time results. Allocate the array with zalloc to ensure 0 count values at the start of the test. Fixes #56 --- source/writeread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/writeread.c b/source/writeread.c index de324f46..ff9ecaa1 100644 --- a/source/writeread.c +++ b/source/writeread.c @@ -169,7 +169,7 @@ int main(int argc, char * const argv[]) goto err; } - counts = OPENSSL_malloc(sizeof(size_t) * threadcount); + counts = OPENSSL_zalloc(sizeof(size_t) * threadcount); if (counts == NULL) { fprintf(stderr, "Failed to create counts array\n"); goto err;