mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-31 13:54:27 +01:00
Non-Unix arena: use zeroed alloc to avoid UB
Reads to the arena were flagged by Miri as UB since it contained uninitialized memory
This commit is contained in:
@@ -467,7 +467,7 @@ mod arena {
|
||||
mod arena {
|
||||
pub fn alloc(len: usize) -> *mut u8 {
|
||||
let layout = std::alloc::Layout::from_size_align(len, std::mem::size_of::<u8>()).unwrap();
|
||||
unsafe { std::alloc::alloc(layout) }
|
||||
unsafe { std::alloc::alloc_zeroed(layout) }
|
||||
}
|
||||
pub fn dealloc(ptr: *mut u8, len: usize) {
|
||||
let layout = std::alloc::Layout::from_size_align(len, std::mem::size_of::<u8>()).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user