Skip to content
Snippets Groups Projects
Commit 384b4101 authored by Stefan Lankes's avatar Stefan Lankes
Browse files

don't leak memory if the environment is empty

parent 8c8a2fdc
No related tags found
No related merge requests found
......@@ -41,7 +41,12 @@ pub trait SyscallInterface: Send + Sync {
let argc = argv.len() as i32;
let argv = argv.leak().as_ptr();
let envv = envv.leak().as_ptr();
// do we have more than a end marker? If not, return as null pointer
let envv = if envv.len() == 1 {
core::ptr::null::<*const u8>()
} else {
envv.leak().as_ptr()
};
(argc, argv, envv)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment