Commit f5b92137 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ntdll: Do not check for malloc() failure in get_initial_environment.

This is called early in process startup; malloc() should definitely never fail here. This fixes an uninitialized variable warning with gcc 12.2: In function ‘build_initial_params’, inlined from ‘init_startup_info’ at ../wine/dlls/ntdll/unix/env.c:2004:18: ../wine/dlls/ntdll/unix/env.c:1910:12: error: ‘env_pos’ may be used uninitialized [-Werror=maybe-uninitialized] 1910 | path = get_env_var( env, env_pos, pathW, 4 ); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../wine/dlls/ntdll/unix/env.c: In function ‘init_startup_info’: ../wine/dlls/ntdll/unix/env.c:1903:18: note: ‘env_pos’ declared here 1903 | SIZE_T size, env_pos, env_size; | ^~~~~~~
parent ed0d100e
...@@ -920,7 +920,7 @@ static WCHAR *get_initial_environment( SIZE_T *pos, SIZE_T *size ) ...@@ -920,7 +920,7 @@ static WCHAR *get_initial_environment( SIZE_T *pos, SIZE_T *size )
*size = 1; *size = 1;
for (e = main_envp; *e; e++) *size += strlen(*e) + 1; for (e = main_envp; *e; e++) *size += strlen(*e) + 1;
if (!(env = malloc( *size * sizeof(WCHAR) ))) return NULL; env = malloc( *size * sizeof(WCHAR) );
ptr = env; ptr = env;
end = env + *size - 1; end = env + *size - 1;
for (e = main_envp; *e && ptr < end; e++) for (e = main_envp; *e && ptr < end; e++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment