From 792084e5047960647f5d64b74a793cba99fa435f Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Mon, 6 May 2024 23:30:03 +0200 Subject: [PATCH] Aktualisieren von alloc.rs --- rustler/src/alloc.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rustler/src/alloc.rs b/rustler/src/alloc.rs index 799841ac..3478dded 100644 --- a/rustler/src/alloc.rs +++ b/rustler/src/alloc.rs @@ -16,8 +16,7 @@ unsafe impl GlobalAlloc for EnifAllocator { if layout.align() > MAX_ALIGN { // overallocate and store the original pointer in memory immediately before the aligned // section - let padded = layout.pad_to_align(); - let total_size = SIZEOF_USIZE + padded.size(); + let total_size = SIZEOF_USIZE + layout.size() + layout.align() - 1; let ptr = rustler_sys::enif_alloc(total_size) as *mut u8; let ptr1 = ptr.wrapping_add(SIZEOF_USIZE);