diff options
76 files changed, 202 insertions, 390 deletions
diff --git a/apps/apps.c b/apps/apps.c index 233d382cd5..1dcaabf87d 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -1114,8 +1114,7 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin, goto end; } end: - if (key != NULL) - BIO_free(key); + BIO_free(key); if (pkey == NULL) BIO_printf(err, "unable to load %s\n", key_descrip); return (pkey); @@ -1682,8 +1681,7 @@ BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai) ai = NULL; } err: - if (in != NULL) - BIO_free(in); + BIO_free(in); if (ai != NULL) ASN1_INTEGER_free(ai); return (ret); @@ -1741,8 +1739,7 @@ int save_serial(char *serialfile, char *suffix, BIGNUM *serial, ai = NULL; } err: - if (out != NULL) - BIO_free_all(out); + BIO_free_all(out); if (ai != NULL) ASN1_INTEGER_free(ai); return (ret); @@ -1896,8 +1893,7 @@ CA_DB *load_index(char *dbfile, DB_ATTR *db_attr) NCONF_free(dbattr_conf); if (tmpdb) TXT_DB_free(tmpdb); - if (in) - BIO_free_all(in); + BIO_free_all(in); return retdb; } diff --git a/apps/asn1pars.c b/apps/asn1pars.c index da950115e3..1576f1cc05 100644 --- a/apps/asn1pars.c +++ b/apps/asn1pars.c @@ -370,12 +370,9 @@ int MAIN(int argc, char **argv) ret = 0; end: BIO_free(derout); - if (in != NULL) - BIO_free(in); - if (out != NULL) - BIO_free_all(out); - if (b64 != NULL) - BIO_free(b64); + BIO_free(in); + BIO_free_all(out); + BIO_free(b64); if (ret != 0) ERR_print_errors(bio_err); if (buf != NULL) @@ -1566,8 +1566,7 @@ static int certify(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509, err: if (req != NULL) X509_REQ_free(req); - if (in != NULL) - BIO_free(in); + BIO_free(in); return (ok); } diff --git a/apps/ciphers.c b/apps/ciphers.c index 803b021f5c..6c7ff01eea 100644 --- a/apps/ciphers.c +++ b/apps/ciphers.c @@ -227,8 +227,7 @@ int MAIN(int argc, char **argv) SSL_CTX_free(ctx); if (ssl != NULL) SSL_free(ssl); - if (STDout != NULL) - BIO_free_all(STDout); + BIO_free_all(STDout); apps_shutdown(); OPENSSL_EXIT(ret); } diff --git a/apps/crl2p7.c b/apps/crl2p7.c index 0763817e61..ab0c3d6d28 100644 --- a/apps/crl2p7.c +++ b/apps/crl2p7.c @@ -268,10 +268,8 @@ int MAIN(int argc, char **argv) } ret = 0; end: - if (in != NULL) - BIO_free(in); - if (out != NULL) - BIO_free_all(out); + BIO_free(in); + BIO_free_all(out); if (p7 != NULL) PKCS7_free(p7); if (crl != NULL) @@ -326,8 +324,7 @@ static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile) ret = count; end: /* never need to OPENSSL_free x */ - if (in != NULL) - BIO_free(in); + BIO_free(in); if (sk != NULL) sk_X509_INFO_free(sk); return (ret); diff --git a/apps/dgst.c b/apps/dgst.c index 95e5fa3fc7..ac3b583793 100644 --- a/apps/dgst.c +++ b/apps/dgst.c @@ -518,8 +518,7 @@ int MAIN(int argc, char **argv) OPENSSL_cleanse(buf, BUFSIZE); OPENSSL_free(buf); } - if (in != NULL) - BIO_free(in); + BIO_free(in); if (passin) OPENSSL_free(passin); BIO_free_all(out); @@ -530,8 +529,7 @@ int MAIN(int argc, char **argv) sk_OPENSSL_STRING_free(macopts); if (sigbuf) OPENSSL_free(sigbuf); - if (bmd != NULL) - BIO_free(bmd); + BIO_free(bmd); apps_shutdown(); OPENSSL_EXIT(err); } @@ -310,10 +310,8 @@ int MAIN(int argc, char **argv) } ret = 0; end: - if (in != NULL) - BIO_free(in); - if (out != NULL) - BIO_free_all(out); + BIO_free(in); + BIO_free_all(out); DH_free(dh); apps_shutdown(); OPENSSL_EXIT(ret); diff --git a/apps/dhparam.c b/apps/dhparam.c index 12a2be6455..fc5962a7a1 100644 --- a/apps/dhparam.c +++ b/apps/dhparam.c @@ -515,10 +515,8 @@ int MAIN(int argc, char **argv) } ret = 0; end: - if (in != NULL) - BIO_free(in); - if (out != NULL) - BIO_free_all(out); + BIO_free(in); + BIO_free_all(out); DH_free(dh); apps_shutdown(); OPENSSL_EXIT(ret); diff --git a/apps/dsa.c b/apps/dsa.c index 8d085bcef2..1ea0d7346d 100644 --- a/apps/dsa.c +++ b/apps/dsa.c @@ -356,10 +356,8 @@ int MAIN(int argc, char **argv) } else ret = 0; end: - if (in != NULL) - BIO_free(in); - if (out != NULL) - BIO_free_all(out); + BIO_free(in); + BIO_free_all(out); DSA_free(dsa); if (passin) OPENSSL_free(passin); diff --git a/apps/dsaparam.c b/apps/dsaparam.c index fc1c817604..f63ecb28ec 100644 --- a/apps/dsaparam.c +++ b/apps/dsaparam.c @@ -434,10 +434,8 @@ int MAIN(int argc, char **argv) end: if (cb != NULL) BN_GENCB_free(cb); - if (in != NULL) - BIO_free(in); - if (out != NULL) - BIO_free_all(out); + BIO_free(in); + BIO_free_all(out); DSA_free(dsa); apps_shutdown(); OPENSSL_EXIT(ret); @@ -343,10 +343,8 @@ int MAIN(int argc, char **argv) } else ret = 0; end: - if (in) - BIO_free(in); - if (out) - BIO_free_all(out); + BIO_free(in); + BIO_free_all(out); if (eckey) EC_KEY_free(eckey); if (passin) diff --git a/apps/ecparam.c b/apps/ecparam.c index 06ac77b838..d4177474d5 100644 --- a/apps/ecparam.c +++ b/apps/ecparam.c @@ -621,10 +621,8 @@ int MAIN(int argc, char **argv) BN_free(ec_cofactor); if (buffer) OPENSSL_free(buffer); - if (in != NULL) - BIO_free(in); - if (out != NULL) - BIO_free_all(out); + BIO_free(in); + BIO_free_all(out); if (group != NULL) EC_GROUP_free(group); apps_shutdown(); diff --git a/apps/enc.c b/apps/enc.c index 1739b7ec23..b95a6a2031 100644 --- a/apps/enc.c +++ b/apps/enc.c @@ -657,17 +657,12 @@ int MAIN(int argc, char **argv) OPENSSL_free(strbuf); if (buff != NULL) OPENSSL_free(buff); - if (in != NULL) - BIO_free(in); - if (out != NULL) - BIO_free_all(out); - if (benc != NULL) - BIO_free(benc); - if (b64 != NULL) - BIO_free(b64); + BIO_free(in); + BIO_free_all(out); + BIO_free(benc); + BIO_free(b64); #ifdef ZLIB - if (bzl != NULL) - BIO_free(bzl); + BIO_free(bzl); #endif if (pass) OPENSSL_free(pass); diff --git a/apps/engine.c b/apps/engine.c index 8a1e746ab6..53864650ac 100644 --- a/apps/engine.c +++ b/apps/engine.c @@ -497,8 +497,7 @@ int MAIN(int argc, char **argv) sk_OPENSSL_STRING_pop_free(engines, identity); sk_OPENSSL_STRING_pop_free(pre_cmds, identity); sk_OPENSSL_STRING_pop_free(post_cmds, identity); - if (bio_out != NULL) - BIO_free_all(bio_out); + BIO_free_all(bio_out); apps_shutdown(); OPENSSL_EXIT(ret); } diff --git a/apps/errstr.c b/apps/errstr.c index c2d4fdec35..668c5f3024 100644 --- a/apps/errstr.c +++ b/apps/errstr.c @@ -100,8 +100,7 @@ int MAIN(int argc, char **argv) lh_ERR_STRING_DATA_node_usage_stats_bio(ERR_get_string_table(), out); } - if (out != NULL) - BIO_free_all(out); + BIO_free_all(out); argc--; argv++; } diff --git a/apps/gendh.c b/apps/gendh.c index 6102b79511..904bcf3a94 100644 --- a/apps/gendh.c +++ b/apps/gendh.c @@ -210,8 +210,7 @@ int MAIN(int argc, char **argv) end: if (ret != 0) ERR_print_errors(bio_err); - if (out != NULL) - BIO_free_all(out); + BIO_free_all(out); DH_free(dh); if (cb != NULL) BN_GENCB_free(cb); diff --git a/apps/gendsa.c b/apps/gendsa.c index d330a01002..8288eb90ab 100644 --- a/apps/gendsa.c +++ b/apps/gendsa.c @@ -267,10 +267,8 @@ int MAIN(int argc, char **argv) end: if (ret != 0) ERR_print_errors(bio_err); - if (in != NULL) - BIO_free(in); - if (out != NULL) - BIO_free_all(out); + BIO_free(in); + BIO_free_all(out); DSA_free(dsa); if (passout) OPENSSL_free(passout); diff --git a/apps/genpkey.c b/apps/genpkey.c index fc19a928c3..5b7f4335b1 100644 --- a/apps/genpkey.c +++ b/apps/genpkey.c @@ -272,8 +272,7 @@ int MAIN(int argc, char **argv) EVP_PKEY_free(pkey); if (ctx) EVP_PKEY_CTX_free(ctx); - if (out) - BIO_free_all(out); + BIO_free_all(out); BIO_free(in); if (pass) OPENSSL_free(pass); diff --git a/apps/genrsa.c b/apps/genrsa.c index 1b06c82e40..cf60219642 100644 --- a/apps/genrsa.c +++ b/apps/genrsa.c @@ -312,8 +312,7 @@ int MAIN(int argc, char **argv) if (cb) BN_GENCB_free(cb); RSA_free(rsa); - if (out) - BIO_free_all(out); + BIO_free_all(out); if (passout) OPENSSL_free(passout); if (ret != 0) diff --git a/apps/ocsp.c b/apps/ocsp.c index 83a71752b1..95380964a3 100644 --- a/apps/ocsp.c +++ b/apps/ocsp.c @@ -1362,8 +1362,7 @@ OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req, if (!resp) BIO_printf(bio_err, "Error querying OCSP responder\n"); end: - if (cbio) - BIO_free_all(cbio); + BIO_free_all(cbio); if (ctx) SSL_CTX_free(ctx); return resp; diff --git a/apps/openssl.c b/apps/openssl.c index e070a444a5..e93aed702a 100644 --- a/apps/openssl.c +++ b/apps/openssl.c @@ -431,10 +431,8 @@ int main(int Argc, char *ARGV[]) #endif apps_shutdown(); CRYPTO_mem_leaks(bio_err); - if (bio_err != NULL) { - BIO_free(bio_err); - bio_err = NULL; - } + BIO_free(bio_err); + bio_err = NULL; OPENSSL_EXIT(ret); } diff --git a/apps/passwd.c b/apps/passwd.c index 798a6d5936..2814b32c75 100644 --- a/apps/passwd.c +++ b/apps/passwd.c @@ -273,10 +273,8 @@ int MAIN(int argc, char **argv) OPENSSL_free(salt_malloc); if (passwd_malloc) OPENSSL_free(passwd_malloc); - if (in) - BIO_free(in); - if (out) - BIO_free_all(out); + BIO_free(in); + BIO_free_all(out); apps_shutdown(); OPENSSL_EXIT(ret); } diff --git a/apps/pkcs7.c b/apps/pkcs7.c index 643507f216..1b07c022a4 100644 --- a/apps/pkcs7.c +++ b/apps/pkcs7.c @@ -299,10 +299,8 @@ int MAIN(int argc, char **argv) end: if (p7 != NULL) PKCS7_free(p7); - if (in != NULL) - BIO_free(in); - if (out != NULL) - BIO_free_all(out); + BIO_free(in); + BIO_free_all(out); apps_shutdown(); OPENSSL_EXIT(ret); } diff --git a/apps/rand.c b/apps/rand.c index e159da37be..45f16b9094 100644 --- a/apps/rand.c +++ b/apps/rand.c @@ -222,8 +222,7 @@ int MAIN(int argc, char **argv) err: ERR_print_errors(bio_err); - if (out) - BIO_free_all(out); + BIO_free_all(out); apps_shutdown(); OPENSSL_EXIT(ret); } diff --git a/apps/rsa.c b/apps/rsa.c index ac4a3c43ef..2f3f871a33 100644 --- a/apps/rsa.c +++ b/apps/rsa.c @@ -422,8 +422,7 @@ int MAIN(int argc, char **argv) } else ret = 0; end: - if (out != NULL) - BIO_free_all(out); + BIO_free_all(out); RSA_free(rsa); if (passin) OPENSSL_free(passin); diff --git a/apps/s_client.c b/apps/s_client.c index cdea32280c..08749830ba 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -2059,14 +2059,10 @@ int MAIN(int argc, char **argv) OPENSSL_cleanse(mbuf, BUFSIZZ); OPENSSL_free(mbuf); } - if (bio_c_out != NULL) { - BIO_free(bio_c_out); - bio_c_out = NULL; - } - if (bio_c_msg != NULL) { - BIO_free(bio_c_msg); - bio_c_msg = NULL; - } + BIO_free(bio_c_out); + bio_c_out = NULL; + BIO_free(bio_c_msg); + bio_c_msg = NULL; apps_shutdown(); OPENSSL_EXIT(ret); } |