diff options
author | Rich Salz <rsalz@openssl.org> | 2015-04-30 21:37:06 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-04-30 21:37:06 -0400 |
commit | 23a1d5e97cd543d2b8e1b01dbf0f619b2e5ce540 (patch) | |
tree | 2d9372864fc2b34939d21b3706768ec225c9548f /crypto/dh/dh_key.c | |
parent | 34166d41892643a36ad2d1f53cc0025e2edc2a39 (diff) |
free NULL cleanup 7
This gets BN_.*free:
BN_BLINDING_free BN_CTX_free BN_FLG_FREE BN_GENCB_free
BN_MONT_CTX_free BN_RECP_CTX_free BN_clear_free BN_free BUF_MEM_free
Also fix a call to DSA_SIG_free to ccgost engine and remove some #ifdef'd
dead code in engines/e_ubsec.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/dh/dh_key.c')
-rw-r--r-- | crypto/dh/dh_key.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/crypto/dh/dh_key.c b/crypto/dh/dh_key.c index 9e2c8b26e6..e2f48b142d 100644 --- a/crypto/dh/dh_key.c +++ b/crypto/dh/dh_key.c @@ -172,12 +172,10 @@ static int generate_key(DH *dh) prk = priv_key; if (!dh->meth->bn_mod_exp(dh, pub_key, dh->g, prk, dh->p, ctx, mont)) { - if (local_prk) - BN_free(local_prk); + BN_free(local_prk); goto err; } - if (local_prk) - BN_free(local_prk); + BN_free(local_prk); } dh->pub_key = pub_key; @@ -187,9 +185,9 @@ static int generate_key(DH *dh) if (ok != 1) DHerr(DH_F_GENERATE_KEY, ERR_R_BN_LIB); - if ((pub_key != NULL) && (dh->pub_key == NULL)) + if (pub_key != dh->pub_key) BN_free(pub_key); - if ((priv_key != NULL) && (dh->priv_key == NULL)) + if (priv_key != dh->priv_key) BN_free(priv_key); BN_CTX_free(ctx); return (ok); @@ -273,7 +271,6 @@ static int dh_init(DH *dh) static int dh_finish(DH *dh) { - if (dh->method_mont_p) - BN_MONT_CTX_free(dh->method_mont_p); + BN_MONT_CTX_free(dh->method_mont_p); return (1); } |