diff options
Diffstat (limited to 'crypto/dh')
-rw-r--r-- | crypto/dh/dh_ameth.c | 6 | ||||
-rw-r--r-- | crypto/dh/dh_asn1.c | 3 | ||||
-rw-r--r-- | crypto/dh/dh_lib.c | 1 | ||||
-rw-r--r-- | crypto/dh/dhtest.c | 6 |
4 files changed, 6 insertions, 10 deletions
diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c index 17027c544f..c71538fa15 100644 --- a/crypto/dh/dh_ameth.c +++ b/crypto/dh/dh_ameth.c @@ -142,8 +142,7 @@ static int dh_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) err: if (public_key) ASN1_INTEGER_free(public_key); - if (dh) - DH_free(dh); + DH_free(dh); return 0; } @@ -711,8 +710,7 @@ static int dh_cms_set_peerkey(EVP_PKEY_CTX *pctx, ASN1_INTEGER_free(public_key); if (pkpeer) EVP_PKEY_free(pkpeer); - if (dhpeer) - DH_free(dhpeer); + DH_free(dhpeer); return rv; } diff --git a/crypto/dh/dh_asn1.c b/crypto/dh/dh_asn1.c index f470214399..7066cafce6 100644 --- a/crypto/dh/dh_asn1.c +++ b/crypto/dh/dh_asn1.c @@ -142,8 +142,7 @@ DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length) } if (a) { - if (*a) - DH_free(*a); + DH_free(*a); *a = dh; } diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c index 46d1a2b7b9..4f07a277ea 100644 --- a/crypto/dh/dh_lib.c +++ b/crypto/dh/dh_lib.c @@ -170,6 +170,7 @@ DH *DH_new_method(ENGINE *engine) void DH_free(DH *r) { int i; + if (r == NULL) return; i = CRYPTO_add(&r->references, -1, CRYPTO_LOCK_DH); diff --git a/crypto/dh/dhtest.c b/crypto/dh/dhtest.c index 9bb9a00212..6c063daf3d 100644 --- a/crypto/dh/dhtest.c +++ b/crypto/dh/dhtest.c @@ -199,10 +199,8 @@ int main(int argc, char *argv[]) OPENSSL_free(abuf); if (bbuf != NULL) OPENSSL_free(bbuf); - if (b != NULL) - DH_free(b); - if (a != NULL) - DH_free(a); + DH_free(b); + DH_free(a); if (_cb) BN_GENCB_free(_cb); BIO_free(out); |