From e0e920b1a063f14f36418f8795c96f2c649400e1 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Sat, 11 Apr 2015 16:32:54 -0400 Subject: free NULL cleanup 9 Ongoing work to skip NULL check before calling free routine. This gets: ecp_nistz256_pre_comp_free nistp224_pre_comp_free nistp256_pre_comp_free nistp521_pre_comp_free PKCS7_free PKCS7_RECIP_INFO_free PKCS7_SIGNER_INFO_free sk_PKCS7_pop_free PKCS8_PRIV_KEY_INFO_free PKCS12_free PKCS12_SAFEBAG_free PKCS12_free sk_PKCS12_SAFEBAG_pop_free SSL_CONF_CTX_free SSL_CTX_free SSL_SESSION_free SSL_free ssl_cert_free ssl_sess_cert_free Reviewed-by: Kurt Roeckx --- apps/apps.c | 3 +-- apps/crl2p7.c | 3 +-- apps/pkcs12.c | 7 ++----- apps/pkcs7.c | 3 +-- 4 files changed, 5 insertions(+), 11 deletions(-) (limited to 'apps') diff --git a/apps/apps.c b/apps/apps.c index 1dcaabf87d..65d4e46d57 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -786,8 +786,7 @@ static int load_pkcs12(BIO *err, BIO *in, const char *desc, } ret = PKCS12_parse(p12, pass, pkey, cert, ca); die: - if (p12) - PKCS12_free(p12); + PKCS12_free(p12); return ret; } diff --git a/apps/crl2p7.c b/apps/crl2p7.c index ab0c3d6d28..86b3a94760 100644 --- a/apps/crl2p7.c +++ b/apps/crl2p7.c @@ -270,8 +270,7 @@ int MAIN(int argc, char **argv) end: BIO_free(in); BIO_free_all(out); - if (p7 != NULL) - PKCS7_free(p7); + PKCS7_free(p7); if (crl != NULL) X509_CRL_free(crl); diff --git a/apps/pkcs12.c b/apps/pkcs12.c index a60a055040..43892e5798 100644 --- a/apps/pkcs12.c +++ b/apps/pkcs12.c @@ -740,8 +740,7 @@ int MAIN(int argc, char **argv) # endif ret = 0; end: - if (p12) - PKCS12_free(p12); + PKCS12_free(p12); if (export_cert || inrand) app_RAND_write_file(NULL, bio_err); # ifdef CRYPTO_MDEBUG @@ -798,9 +797,7 @@ int dump_certs_keys_p12(BIO *out, PKCS12 *p12, char *pass, ret = 1; err: - - if (asafes) - sk_PKCS7_pop_free(asafes, PKCS7_free); + sk_PKCS7_pop_free(asafes, PKCS7_free); return ret; } diff --git a/apps/pkcs7.c b/apps/pkcs7.c index 1b07c022a4..4fcb089b2b 100644 --- a/apps/pkcs7.c +++ b/apps/pkcs7.c @@ -297,8 +297,7 @@ int MAIN(int argc, char **argv) } ret = 0; end: - if (p7 != NULL) - PKCS7_free(p7); + PKCS7_free(p7); BIO_free(in); BIO_free_all(out); apps_shutdown(); -- cgit v1.2.3