Skip to content

Commit f81e905

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 07002fb commit f81e905

File tree

1 file changed

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

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,13 @@ compat_fn_with_fallback! {
417417
Sleep(0);
418418
TRUE
419419
}
420+
421+
// >= NT 3.5+, 95+
422+
// https://docs.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-freeenvironmentstringsw
423+
pub fn FreeEnvironmentStringsW(penv: PCWSTR) -> BOOL {
424+
// just leak it on NT 3.1
425+
TRUE
426+
}
420427
}
421428

422429
compat_fn_lazy! {

0 commit comments

Comments
 (0)