about summary refs log tree commit diff
path: root/src/rt/rust_upcall.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-05-29 12:29:21 -0700
committerBrian Anderson <banderson@mozilla.com>2012-05-30 21:23:34 -0700
commitb16bdd9ed097ea91a71f3bbffbad4c5e7d57722e (patch)
tree98e9f7531125a1a69fbb495649b36661b1ef2485 /src/rt/rust_upcall.cpp
parenta2bbdd3f52a71beabc1beb964772d30045cbe949 (diff)
downloadrust-b16bdd9ed097ea91a71f3bbffbad4c5e7d57722e.tar.gz
rust-b16bdd9ed097ea91a71f3bbffbad4c5e7d57722e.zip
rt: Don't zero the unique box header
Diffstat (limited to 'src/rt/rust_upcall.cpp')
-rw-r--r--src/rt/rust_upcall.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index 01606b37903..ac11ee7a26b 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<rust_opaque_box*>(p);
     header->td = td;
 
+    memset(&header[1], '\0', body_size);
+
     return (uintptr_t)header;
 }