GCC 12 (rightfully) would warn dlls/ntdll/unix/env.c:1910:12: warning: 'env_pos' may be used uninitialized
Signed-off-by: Gerald Pfeifer gerald@pfeifer.com --- dlls/ntdll/unix/env.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c index 105038a34cb..cbbfb99f4b3 100644 --- a/dlls/ntdll/unix/env.c +++ b/dlls/ntdll/unix/env.c @@ -920,7 +920,11 @@ static WCHAR *get_initial_environment( SIZE_T *pos, SIZE_T *size ) *size = 1; for (e = main_envp; *e; e++) *size += strlen(*e) + 1;
- if (!(env = malloc( *size * sizeof(WCHAR) ))) return NULL; + if (!(env = malloc( *size * sizeof(WCHAR) ))) + { + *pos = 0; + return NULL; + } ptr = env; end = env + *size - 1; for (e = main_envp; *e && ptr < end; e++)