Fixed leakage

This commit is contained in:
Erin 2023-08-17 21:55:37 +02:00 committed by ondra05
parent 73eed89ab3
commit 782cf5a5e8
2 changed files with 3 additions and 1 deletions

View file

@ -39,6 +39,8 @@ fuzz_target!(|data: &[u8]| {
for (i, page) in pages.into_iter().enumerate() { for (i, page) in pages.into_iter().enumerate() {
unmap_and_dealloc(&mut vm.memory, page, i as u64 * 4096); unmap_and_dealloc(&mut vm.memory, page, i as u64 * 4096);
} }
let _ = unsafe { Box::from_raw(vm.memory.root_pt) };
} }
}); });

View file

@ -47,12 +47,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Program interrupt: {:?}", vm.run()); println!("Program interrupt: {:?}", vm.run());
println!("{:?}", vm.registers); println!("{:?}", vm.registers);
println!("{:?}", core::slice::from_raw_parts(data, 4096));
std::alloc::dealloc( std::alloc::dealloc(
data, data,
std::alloc::Layout::from_size_align_unchecked(4096, 4096), std::alloc::Layout::from_size_align_unchecked(4096, 4096),
); );
vm.memory.unmap(8192).unwrap(); vm.memory.unmap(8192).unwrap();
let _ = Box::from_raw(vm.memory.root_pt);
} }
} }
Ok(()) Ok(())