summaryrefslogtreecommitdiffstats
path: root/crypto/dh
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2015-03-24 07:52:24 -0400
committerRich Salz <rsalz@openssl.org>2015-03-24 07:52:24 -0400
commit0dfb9398bb6493d5a56216e0c7039cb3f9fc88c6 (patch)
tree9ffaa0bec3d0f14092948174eeea90dc8e2ee7c4 /crypto/dh
parent7c82e339a677f8546e1456c7a8f6788598a9de43 (diff)
free NULL cleanup
Start ensuring all OpenSSL "free" routines allow NULL, and remove any if check before calling them. This gets ASN1_OBJECT_free and ASN1_STRING_free. Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'crypto/dh')
-rw-r--r--crypto/dh/dh_ameth.c6
-rw-r--r--crypto/dh/dh_pmeth.c6
2 files changed, 4 insertions, 8 deletions
diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c
index 2c77381a48..e7d56f1a89 100644
--- a/crypto/dh/dh_ameth.c
+++ b/crypto/dh/dh_ameth.c
@@ -191,8 +191,7 @@ static int dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
err:
if (penc)
OPENSSL_free(penc);
- if (str)
- ASN1_STRING_free(str);
+ ASN1_STRING_free(str);
return 0;
}
@@ -297,8 +296,7 @@ static int dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
err:
if (dp != NULL)
OPENSSL_free(dp);
- if (params != NULL)
- ASN1_STRING_free(params);
+ ASN1_STRING_free(params);
if (prkey != NULL)
ASN1_STRING_clear_free(prkey);
return 0;
diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c
index 8975f4492a..668f5f3a87 100644
--- a/crypto/dh/dh_pmeth.c
+++ b/crypto/dh/dh_pmeth.c
@@ -155,8 +155,7 @@ static void pkey_dh_cleanup(EVP_PKEY_CTX *ctx)
if (dctx) {
if (dctx->kdf_ukm)
OPENSSL_free(dctx->kdf_ukm);
- if (dctx->kdf_oid)
- ASN1_OBJECT_free(dctx->kdf_oid);
+ ASN1_OBJECT_free(dctx->kdf_oid);
OPENSSL_free(dctx);
}
}
@@ -245,8 +244,7 @@ static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
return dctx->kdf_ukmlen;
case EVP_PKEY_CTRL_DH_KDF_OID:
- if (dctx->kdf_oid)
- ASN1_OBJECT_free(dctx->kdf_oid);
+ ASN1_OBJECT_free(dctx->kdf_oid);
dctx->kdf_oid = p2;
return 1;