From 8bf780432c11bcedf20161f5e76bc19e300af419 Mon Sep 17 00:00:00 2001 From: FdaSilvaYY Date: Fri, 20 May 2016 23:36:18 +0200 Subject: [PATCH] Indent and dead code cleanup tofree pointer is no more used... Reviewed-by: Richard Levitte Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/1103) --- apps/ca.c | 83 +++++++++++++++++++++++++++--------------------------- apps/srp.c | 4 +-- 2 files changed, 43 insertions(+), 44 deletions(-) diff --git a/apps/ca.c b/apps/ca.c index e8a0713051..acbd3886c6 100644 --- a/apps/ca.c +++ b/apps/ca.c @@ -240,7 +240,7 @@ int ca_main(int argc, char **argv) char *outdir = NULL, *outfile = NULL, *rev_arg = NULL, *ser_status = NULL; char *serialfile = NULL, *startdate = NULL, *subj = NULL; char *prog, *enddate = NULL, *tmp_email_dn = NULL; - char *dbfile = NULL, *f, *randfile = NULL, *tofree = NULL; + char *dbfile = NULL, *f, *randfile = NULL; char buf[3][BSIZE]; char *const *pp; const char *p; @@ -258,38 +258,38 @@ int ca_main(int argc, char **argv) prog = opt_init(argc, argv, ca_options); while ((o = opt_next()) != OPT_EOF) { switch (o) { - case OPT_EOF: - case OPT_ERR: + case OPT_EOF: + case OPT_ERR: opthelp: - BIO_printf(bio_err, "%s: Use -help for summary.\n", prog); - goto end; - case OPT_HELP: - opt_help(ca_options); - ret = 0; - goto end; - case OPT_IN: - req = 1; - infile = opt_arg(); - break; - case OPT_OUT: - outfile = opt_arg(); - break; - case OPT_VERBOSE: - verbose = 1; - break; - case OPT_CONFIG: - configfile = opt_arg(); - break; - case OPT_NAME: - section = opt_arg(); - break; - case OPT_SUBJ: - subj = opt_arg(); - /* preserve=1; */ - break; - case OPT_UTF8: - chtype = MBSTRING_UTF8; - break; + BIO_printf(bio_err, "%s: Use -help for summary.\n", prog); + goto end; + case OPT_HELP: + opt_help(ca_options); + ret = 0; + goto end; + case OPT_IN: + req = 1; + infile = opt_arg(); + break; + case OPT_OUT: + outfile = opt_arg(); + break; + case OPT_VERBOSE: + verbose = 1; + break; + case OPT_CONFIG: + configfile = opt_arg(); + break; + case OPT_NAME: + section = opt_arg(); + break; + case OPT_SUBJ: + subj = opt_arg(); + /* preserve=1; */ + break; + case OPT_UTF8: + chtype = MBSTRING_UTF8; + break; case OPT_CREATE_SERIAL: create_ser = 1; break; @@ -496,7 +496,7 @@ end_of_options: } else ERR_clear_error(); - /*****************************************************************/ + /*****************************************************************/ /* report status of cert with serial number given on command line */ if (ser_status) { if ((dbfile = NCONF_get_string(conf, section, ENV_DATABASE)) == NULL) { @@ -515,7 +515,7 @@ end_of_options: goto end; } - /*****************************************************************/ + /*****************************************************************/ /* we definitely need a private key, so let's get it */ if ((keyfile == NULL) && ((keyfile = NCONF_get_string(conf, @@ -540,7 +540,7 @@ end_of_options: goto end; } - /*****************************************************************/ + /*****************************************************************/ /* we need a certificate */ if (!selfsign || spkac_file || ss_cert_file || gencrl) { if ((certfile == NULL) @@ -608,7 +608,7 @@ end_of_options: } else ERR_clear_error(); - /*****************************************************************/ + /*****************************************************************/ /* lookup where to write new certificates */ if ((outdir == NULL) && (req)) { @@ -634,7 +634,7 @@ end_of_options: #endif } - /*****************************************************************/ + /*****************************************************************/ /* we need to load the database file */ if ((dbfile = NCONF_get_string(conf, section, ENV_DATABASE)) == NULL) { lookup_fail(section, ENV_DATABASE); @@ -692,7 +692,7 @@ end_of_options: if (!index_index(db)) goto end; - /*****************************************************************/ + /*****************************************************************/ /* Update the db file for expired certificates */ if (doupdatedb) { if (verbose) @@ -1060,7 +1060,7 @@ end_of_options: } } - /*****************************************************************/ + /*****************************************************************/ if (gencrl) { int crl_v2 = 0; if (!crl_ext) { @@ -1201,7 +1201,7 @@ end_of_options: goto end; } - /*****************************************************************/ + /*****************************************************************/ if (dorevoke) { if (infile == NULL) { BIO_printf(bio_err, "no input files\n"); @@ -1227,10 +1227,9 @@ end_of_options: BIO_printf(bio_err, "Data Base Updated\n"); } } - /*****************************************************************/ + /*****************************************************************/ ret = 0; end: - OPENSSL_free(tofree); BIO_free_all(Cout); BIO_free_all(Sout); BIO_free_all(out); diff --git a/apps/srp.c b/apps/srp.c index cbbaae4cec..d81346d2d7 100644 --- a/apps/srp.c +++ b/apps/srp.c @@ -212,7 +212,7 @@ int srp_main(int argc, char **argv) int doupdatedb = 0, mode = OPT_ERR; char *user = NULL, *passinarg = NULL, *passoutarg = NULL; char *passin = NULL, *passout = NULL, *gN = NULL, *userinfo = NULL; - char *randfile = NULL, *tofree = NULL, *section = NULL; + char *randfile = NULL, *section = NULL; char **gNrow = NULL, *configfile = NULL; char *srpvfile = NULL, **pp, *prog; OPTION_CHOICE o; @@ -596,7 +596,7 @@ int srp_main(int argc, char **argv) if (verbose) BIO_printf(bio_err, "SRP terminating with code %d.\n", ret); - OPENSSL_free(tofree); + if (ret) ERR_print_errors(bio_err); if (randfile) -- 2.25.1