diff options
author | Rich Salz <rsalz@openssl.org> | 2015-05-01 10:02:07 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-05-01 10:02:07 -0400 |
commit | b548a1f11c06ccdfa4f52a539912d22d77ee309e (patch) | |
tree | 37ff8792ddf09e4805aa3ba76b805923d3c52734 /crypto/dh | |
parent | 33fbca83dcd05b77f807fab205c4523b8cfe85b5 (diff) |
free null cleanup finale
Don't check for NULL before calling OPENSSL_free
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/dh')
-rw-r--r-- | crypto/dh/dh_ameth.c | 17 | ||||
-rw-r--r-- | crypto/dh/dh_kdf.c | 3 | ||||
-rw-r--r-- | crypto/dh/dh_lib.c | 3 | ||||
-rw-r--r-- | crypto/dh/dh_pmeth.c | 6 |
4 files changed, 10 insertions, 19 deletions
diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c index 6a4223c167..c9374b77f9 100644 --- a/crypto/dh/dh_ameth.c +++ b/crypto/dh/dh_ameth.c @@ -187,8 +187,7 @@ static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) return 1; err: - if (penc) - OPENSSL_free(penc); + OPENSSL_free(penc); ASN1_STRING_free(str); return 0; @@ -292,8 +291,7 @@ static int dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) return 1; err: - if (dp != NULL) - OPENSSL_free(dp); + OPENSSL_free(dp); ASN1_STRING_free(params); ASN1_STRING_clear_free(prkey); return 0; @@ -422,8 +420,7 @@ static int do_dh_print(BIO *bp, const DH *x, int indent, err: DHerr(DH_F_DO_DH_PRINT, reason); } - if (m != NULL) - OPENSSL_free(m); + OPENSSL_free(m); return (ret); } @@ -481,11 +478,9 @@ static int int_dh_param_copy(DH *to, const DH *from, int is_x942) return 0; if (!int_dh_bn_cpy(&to->j, from->j)) return 0; - if (to->seed) { - OPENSSL_free(to->seed); - to->seed = NULL; - to->seedlen = 0; - } + OPENSSL_free(to->seed); + to->seed = NULL; + to->seedlen = 0; if (from->seed) { to->seed = BUF_memdup(from->seed, from->seedlen); if (!to->seed) diff --git a/crypto/dh/dh_kdf.c b/crypto/dh/dh_kdf.c index a882cb286e..b812d821e4 100644 --- a/crypto/dh/dh_kdf.c +++ b/crypto/dh/dh_kdf.c @@ -180,8 +180,7 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen, } rv = 1; err: - if (der) - OPENSSL_free(der); + OPENSSL_free(der); EVP_MD_CTX_cleanup(&mctx); return rv; } diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c index 74bad4dfcf..10e98c63ee 100644 --- a/crypto/dh/dh_lib.c +++ b/crypto/dh/dh_lib.c @@ -198,8 +198,7 @@ void DH_free(DH *r) BN_clear_free(r->g); BN_clear_free(r->q); BN_clear_free(r->j); - if (r->seed) - OPENSSL_free(r->seed); + OPENSSL_free(r->seed); BN_clear_free(r->counter); BN_clear_free(r->pub_key); BN_clear_free(r->priv_key); diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c index 069b855aa0..be44c0b201 100644 --- a/crypto/dh/dh_pmeth.c +++ b/crypto/dh/dh_pmeth.c @@ -153,8 +153,7 @@ static void pkey_dh_cleanup(EVP_PKEY_CTX *ctx) { DH_PKEY_CTX *dctx = ctx->data; if (dctx) { - if (dctx->kdf_ukm) - OPENSSL_free(dctx->kdf_ukm); + OPENSSL_free(dctx->kdf_ukm); ASN1_OBJECT_free(dctx->kdf_oid); OPENSSL_free(dctx); } @@ -230,8 +229,7 @@ static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) return 1; case EVP_PKEY_CTRL_DH_KDF_UKM: - if (dctx->kdf_ukm) - OPENSSL_free(dctx->kdf_ukm); + OPENSSL_free(dctx->kdf_ukm); dctx->kdf_ukm = p2; if (p2) dctx->kdf_ukmlen = p1; |