Fix use of uninitialized variable (conf) if sudoers_debug_register()

happens to fail.
This commit is contained in:
Todd C. Miller
2018-03-01 10:18:48 -07:00
parent 73b5f961ee
commit 8275ab873f

View File

@@ -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;
}