diff options
author | Rich Salz <rsalz@akamai.com> | 2015-03-24 10:17:37 -0400 |
---|---|---|
committer | Rich Salz <rsalz@akamai.com> | 2015-03-24 23:17:16 -0400 |
commit | d64070838ebba86f00fb3755df5d3e65106e1628 (patch) | |
tree | def90b3063d9ebe0f53920604d02b9786216e327 /crypto/dsa | |
parent | 1300705a47b9c9498b15a384c6c5348adc342e2c (diff) |
free NULL cleanup
Start ensuring all OpenSSL "free" routines allow NULL, and remove
any if check before calling them.
This gets DH_free, DSA_free, RSA_free
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'crypto/dsa')
-rw-r--r-- | crypto/dsa/dsa_ameth.c | 3 | ||||
-rw-r--r-- | crypto/dsa/dsa_depr.c | 7 | ||||
-rw-r--r-- | crypto/dsa/dsa_lib.c | 3 | ||||
-rw-r--r-- | crypto/dsa/dsatest.c | 3 |
4 files changed, 6 insertions, 10 deletions
diff --git a/crypto/dsa/dsa_ameth.c b/crypto/dsa/dsa_ameth.c index 61a9d0fc5e..96d5c5ae79 100644 --- a/crypto/dsa/dsa_ameth.c +++ b/crypto/dsa/dsa_ameth.c @@ -120,8 +120,7 @@ static int dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) err: if (public_key) ASN1_INTEGER_free(public_key); - if (dsa) - DSA_free(dsa); + DSA_free(dsa); return 0; } diff --git a/crypto/dsa/dsa_depr.c b/crypto/dsa/dsa_depr.c index be1df138cb..10f0314f18 100644 --- a/crypto/dsa/dsa_depr.c +++ b/crypto/dsa/dsa_depr.c @@ -89,10 +89,8 @@ DSA *DSA_generate_parameters(int bits, if ((ret = DSA_new()) == NULL) return NULL; cb = BN_GENCB_new(); - if (!cb) { - DSA_free(ret); - return NULL; - } + if (!cb) + goto err; BN_GENCB_set_old(cb, callback, cb_arg); @@ -102,6 +100,7 @@ DSA *DSA_generate_parameters(int bits, return ret; } BN_GENCB_free(cb); +err: DSA_free(ret); return NULL; } diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c index eb13fbbbe7..bfd91062f5 100644 --- a/crypto/dsa/dsa_lib.c +++ b/crypto/dsa/dsa_lib.c @@ -315,8 +315,7 @@ DH *DSA_dup_DH(const DSA *r) return ret; err: - if (ret != NULL) - DH_free(ret); + DH_free(ret); return NULL; } #endif diff --git a/crypto/dsa/dsatest.c b/crypto/dsa/dsatest.c index 9b1308926f..bf47816037 100644 --- a/crypto/dsa/dsatest.c +++ b/crypto/dsa/dsatest.c @@ -211,8 +211,7 @@ int main(int argc, char **argv) end: if (!ret) ERR_print_errors(bio_err); - if (dsa != NULL) - DSA_free(dsa); + DSA_free(dsa); if (cb != NULL) BN_GENCB_free(cb); CRYPTO_cleanup_all_ex_data(); |