Skip to content

Commit 02979aa

Browse files
committed
Stub FreeEnvironmentStringsW to just leak on NT 3.1
Yup, this function just doesn't exist on NT 3.1, so `env::vars`/`env::vars_os` will just leak the OS-allocated buffer.
1 parent b0b2be1 commit 02979aa

File tree

1 file changed

+11
-0
lines changed
  • library/std/src/sys/pal/windows

1 file changed

+11
-0
lines changed

library/std/src/sys/pal/windows/c.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,3 +637,14 @@ compat_fn_with_fallback! {
637637
rtabort!("unimplemented")
638638
}
639639
}
640+
641+
#[cfg(target_vendor = "rust9x")]
642+
compat_fn_with_fallback! {
643+
pub static KERNEL32: &CStr = c"kernel32" => { load: false, unicows: true };
644+
// >= NT 3.5+, 95+
645+
// https://learn.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-freeenvironmentstringsw
646+
pub fn FreeEnvironmentStringsW(penv: PCWSTR) -> BOOL {
647+
// just leak it on NT 3.1
648+
TRUE
649+
}
650+
}

0 commit comments

Comments
 (0)