diff options
author | Rich Salz <rsalz@openssl.org> | 2015-03-24 07:52:24 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-03-24 07:52:24 -0400 |
commit | 0dfb9398bb6493d5a56216e0c7039cb3f9fc88c6 (patch) | |
tree | 9ffaa0bec3d0f14092948174eeea90dc8e2ee7c4 /crypto/rsa | |
parent | 7c82e339a677f8546e1456c7a8f6788598a9de43 (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/rsa')
-rw-r--r-- | crypto/rsa/rsa_ameth.c | 9 | ||||
-rw-r--r-- | crypto/rsa/rsa_saos.c | 3 |
2 files changed, 4 insertions, 8 deletions
diff --git a/crypto/rsa/rsa_ameth.c b/crypto/rsa/rsa_ameth.c index 6f4c104858..071dbb8d68 100644 --- a/crypto/rsa/rsa_ameth.c +++ b/crypto/rsa/rsa_ameth.c @@ -484,8 +484,7 @@ static int rsa_md_to_mgf1(X509_ALGOR **palg, const EVP_MD *mgf1md) X509_ALGOR_set0(*palg, OBJ_nid2obj(NID_mgf1), V_ASN1_SEQUENCE, stmp); stmp = NULL; err: - if (stmp) - ASN1_STRING_free(stmp); + ASN1_STRING_free(stmp); if (algtmp) X509_ALGOR_free(algtmp); if (*palg) @@ -576,8 +575,7 @@ static ASN1_STRING *rsa_ctx_to_pss(EVP_PKEY_CTX *pkctx) RSA_PSS_PARAMS_free(pss); if (rv) return os; - if (os) - ASN1_STRING_free(os); + ASN1_STRING_free(os); return NULL; } @@ -921,8 +919,7 @@ static int rsa_cms_encrypt(CMS_RecipientInfo *ri) err: if (oaep) RSA_OAEP_PARAMS_free(oaep); - if (os) - ASN1_STRING_free(os); + ASN1_STRING_free(os); return rv; } diff --git a/crypto/rsa/rsa_saos.c b/crypto/rsa/rsa_saos.c index 6ebab3db55..0f15f00842 100644 --- a/crypto/rsa/rsa_saos.c +++ b/crypto/rsa/rsa_saos.c @@ -138,8 +138,7 @@ int RSA_verify_ASN1_OCTET_STRING(int dtype, } else ret = 1; err: - if (sig != NULL) - ASN1_OCTET_STRING_free(sig); + ASN1_OCTET_STRING_free(sig); if (s != NULL) { OPENSSL_cleanse(s, (unsigned int)siglen); OPENSSL_free(s); |