Skip to content

Commit eafb700

Browse files
committed
rt: Zero out allocations so that the CC won't die if it happens to run while a box is being constructed.
This is kind of unfortunate.
1 parent a63cc03 commit eafb700

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/rt/rust_upcall.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ upcall_malloc(rust_task *task, size_t nbytes, type_desc *td) {
6868
// type_desc.
6969

7070
void *p = task->malloc(nbytes, "tdesc", td);
71+
memset(p, '\0', nbytes);
7172

7273
task->local_allocs[p] = td;
7374

@@ -101,6 +102,7 @@ upcall_shared_malloc(rust_task *task, size_t nbytes, type_desc *td) {
101102
"upcall shared_malloc(%" PRIdPTR ", 0x%" PRIxPTR ")",
102103
nbytes, td);
103104
void *p = task->kernel->malloc(nbytes, "shared malloc");
105+
memset(p, '\0', nbytes);
104106
LOG(task, mem,
105107
"upcall shared_malloc(%" PRIdPTR ", 0x%" PRIxPTR
106108
") = 0x%" PRIxPTR,

0 commit comments

Comments
 (0)