From a11ce9dae57846c45268419cdf9f2813721660e9 Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Sun, 31 Jan 2016 11:36:37 +0100 Subject: [PATCH] libsemanage: initialize bools_modified variable. In semanage_direct_commit() error path, bools_modified can be used in a if statement without being initialized (when a "goto cleanup" is taken early). clang warns about this bug: direct_api.c:1441:18: error: variable 'bools_modified' may be uninitialized when used here [-Werror,-Wconditional-uninitialized] if (modified || bools_modified) { ^~~~~~~~~~~~~~ direct_api.c:1087:48: note: initialize the variable 'bools_modified' to silence this warning preserve_tunables_modified, bools_modified, ^ = 0 Signed-off-by: Nicolas Iooss --- libsemanage/src/direct_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c index 68dd0d18..dd621d99 100644 --- a/libsemanage/src/direct_api.c +++ b/libsemanage/src/direct_api.c @@ -1076,7 +1076,7 @@ static int semanage_direct_commit(semanage_handle_t * sh) /* Declare some variables */ int modified = 0, fcontexts_modified, ports_modified, seusers_modified, users_extra_modified, dontaudit_modified, - preserve_tunables_modified, bools_modified, + preserve_tunables_modified, bools_modified = 0, disable_dontaudit, preserve_tunables; dbase_config_t *users = semanage_user_dbase_local(sh); dbase_config_t *users_base = semanage_user_base_dbase_local(sh);