summaryrefslogtreecommitdiff
path: root/rts/RtsUtils.c
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2016-08-15 02:22:28 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2016-08-15 18:05:46 -0700
commitf9a11a241b8056ac2b9c771172a48919fb3d0ed1 (patch)
tree5808c66fee37b4c39935b00a0e53201bafa72c8c /rts/RtsUtils.c
parentda99a7f515cddb7e9eebd81283375c245e1625d4 (diff)
downloadhaskell-f9a11a241b8056ac2b9c771172a48919fb3d0ed1.tar.gz
When in sanity mode, un-zero malloc'd memory; fix uninitialized memory bugs.
malloc'd memory is not guaranteed to be zeroed. On Linux, however, it is often zeroed, leading to latent bugs. In fact, with this patch I fix two uninitialized memory bugs stemming from this. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonmar, austin, Phyx, bgamari, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2455
Diffstat (limited to 'rts/RtsUtils.c')
-rw-r--r--rts/RtsUtils.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c
index 716d203462..3a9742744f 100644
--- a/rts/RtsUtils.c
+++ b/rts/RtsUtils.c
@@ -79,6 +79,7 @@ stgMallocBytes (size_t n, char *msg)
rtsConfig.mallocFailHook((W_) n, msg); /*msg*/
stg_exit(EXIT_INTERNAL_ERROR);
}
+ IF_DEBUG(sanity, memset(space, 0xbb, n));
return space;
}