From 8275ab873f8174d55b83eeebadf7e0dcac733fce Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 1 Mar 2018 10:18:48 -0700 Subject: [PATCH] Fix use of uninitialized variable (conf) if sudoers_debug_register() happens to fail. --- plugins/sudoers/cvtsudoers.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugins/sudoers/cvtsudoers.c b/plugins/sudoers/cvtsudoers.c index 520a1d60d..7e0f82c79 100644 --- a/plugins/sudoers/cvtsudoers.c +++ b/plugins/sudoers/cvtsudoers.c @@ -82,7 +82,7 @@ main(int argc, char *argv[]) int ch, exitcode = EXIT_FAILURE; enum sudoers_formats output_format = format_ldif; enum sudoers_formats input_format = format_sudoers; - struct cvtsudoers_config *conf; + struct cvtsudoers_config *conf = NULL; const char *input_file = "-"; const char *output_file = "-"; const char *conf_file = _PATH_CVTSUDOERS_CONF; @@ -398,12 +398,14 @@ cvtsudoers_conf_free(struct cvtsudoers_config *conf) { debug_decl(cvtsudoers_conf_free, SUDOERS_DEBUG_UTIL) - free(conf->sudoers_base); - free(conf->input_format); - free(conf->output_format); - conf->sudoers_base = NULL; - conf->input_format = NULL; - conf->output_format = NULL; + if (conf != NULL) { + free(conf->sudoers_base); + free(conf->input_format); + free(conf->output_format); + conf->sudoers_base = NULL; + conf->input_format = NULL; + conf->output_format = NULL; + } debug_return; } -- 2.40.0