Module: wine Branch: master Commit: 4bbdbc759a8c1b8eab8aea8c8f581eafe5ed4d78 URL: https://gitlab.winehq.org/wine/wine/-/commit/4bbdbc759a8c1b8eab8aea8c8f581ea...
Author: Gerald Pfeifer gerald@pfeifer.com Date: Tue Dec 20 00:02:19 2022 +0100
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.
---
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 );