From e2f0094c315746ff15b8d9650cf318f81d8416d7 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Tue, 19 Jul 2022 01:35:40 -0400 Subject: rts/ProfHeap: Ensure new Censuses are zeroed When growing the Census array ProfHeap previously neglected to zero the new part of the array. Consequently `freeEra` would attempt to free random words that often looked suspiciously like pointers. Fixes #21880. --- rts/ProfHeap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 0e3848d616..d9e66d76d1 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -377,6 +377,7 @@ nextEra( void ) n_censuses *= 2; censuses = stgReallocBytes(censuses, sizeof(Census) * n_censuses, "nextEra"); + memset(&censuses[era], 0, sizeof(Census) * n_censuses / 2); } } #endif /* PROFILING */ -- cgit v1.2.1