diff options
Diffstat (limited to 'src/rt/rust_upcall.cpp')
| -rw-r--r-- | src/rt/rust_upcall.cpp | 4 |
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; } |
