Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
xous: ffi: correct size of freed memory
The amount of memory allocated was multiplied by sizeof::<T>(), so the
amount of memory to be freed should also be multiplied by sizeof::<T>().

Signed-off-by: Sean Cross <[email protected]>
  • Loading branch information
xobs committed Jan 13, 2024
commit 944dc212685a4f17db144d14459ee4bc3ffd3423
2 changes: 1 addition & 1 deletion library/std/src/os/xous/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ pub(crate) unsafe fn map_memory<T>(
pub(crate) unsafe fn unmap_memory<T>(range: *mut [T]) -> Result<(), Error> {
let mut a0 = Syscall::UnmapMemory as usize;
let mut a1 = range.as_mut_ptr() as usize;
let a2 = range.len();
let a2 = range.len() * core::mem::size_of::<T>();
let a3 = 0;
let a4 = 0;
let a5 = 0;
Expand Down