[PATCH 0/1] MR1848: wmc: Avoid uninitialized variable in init_argv0_dir
init_argv0_dir has conditional code for different operating systems. In case of FreeBSD a variable remains uninitialized in the error case, yet is then used. Fix that by handling the error case. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1848
From: Gerald Pfeifer <gerald(a)pfeifer.com> init_argv0_dir has conditional code for different operating systems. In case of FreeBSD a variable remains uninitialized in the error case, yet is then used. Fix that by handling the error case. --- tools/wmc/wmc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/wmc/wmc.c b/tools/wmc/wmc.c index f5ff7abcdf9..145acb5d718 100644 --- a/tools/wmc/wmc.c +++ b/tools/wmc/wmc.c @@ -160,6 +160,8 @@ static void init_argv0_dir( const char *argv0 ) char *path = xmalloc( path_size ); if (!sysctl( pathname, ARRAY_SIZE(pathname), path, &path_size, NULL, 0 )) dir = realpath( path, NULL ); + else + dir = NULL; free( path ); #else dir = realpath( argv0, NULL ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1848
participants (2)
-
Gerald Pfeifer -
Gerald Pfeifer (@gerald)