From b16bdd9ed097ea91a71f3bbffbad4c5e7d57722e Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 29 May 2012 12:29:21 -0700 Subject: [PATCH] rt: Don't zero the unique box header --- src/rt/rust_upcall.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index 01606b37903f..ac11ee7a26b7 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -164,14 +164,16 @@ exchange_malloc(rust_task *task, type_desc *td, uintptr_t size) { size_t header_size = sizeof(rust_opaque_box); size_t body_size = size; size_t body_align = td->align; + // FIXME: This alignment calculation is suspicious. Is it right? size_t total_size = align_to(header_size, body_align) + body_size; void *p = task->kernel->malloc(total_size, "exchange malloc"); - memset(p, '\0', total_size); rust_opaque_box *header = static_cast(p); header->td = td; + memset(&header[1], '\0', body_size); + return (uintptr_t)header; }