[PATCH 3/3] dlls/ntdll: suppress GCC12 warning (-Wmaybe-uninitialized)

Eric Pouech wine at gitlab.winehq.org
Fri Jun 10 05:13:56 CDT 2022

From: Eric Pouech <eric.pouech at gmail.com>

GCC12 warns about env variable that could be not initialized
(it could be the case when env copy malloc fails)
This is very unlikely to happen, and there's not much that can be done if
this fails anyway.
Adding an assert (as done in same function for failing virtual alloc)
makes the warning vanish.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
 dlls/ntdll/unix/env.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index a71df03966f..88dbc4e07ae 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -1892,6 +1892,7 @@ static RTL_USER_PROCESS_PARAMETERS *build_initial_params( void **module )
     NTSTATUS status;
     /* store the initial PATH value */
+    assert( env );
     path = get_env_var( env, env_pos, pathW, 4 );
     add_dynamic_environment( &env, &env_pos, &env_size );
     add_registry_environment( &env, &env_pos, &env_size );


More information about the wine-devel mailing list