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.
From: Gerald Pfeifer gerald@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 );