summaryrefslogtreecommitdiffstats
path: root/crypto/evp/evp_enc.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2021-02-15 12:31:36 -0500
committerRichard Levitte <levitte@openssl.org>2021-04-18 10:01:31 +0200
commit543e740b95e303790f8fe6ec59458b4ecdcfb56c (patch)
tree261354d5f3154847e0edc9cae3f81d4f14a855ee /crypto/evp/evp_enc.c
parentad72484909abbcb088c52305894b87604ef58de8 (diff)
Standard style for all EVP_xxx_free routines
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14193)
Diffstat (limited to 'crypto/evp/evp_enc.c')
-rw-r--r--crypto/evp/evp_enc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c
index 2e4a3227a1..9073312dfd 100644
--- a/crypto/evp/evp_enc.c
+++ b/crypto/evp/evp_enc.c
@@ -68,6 +68,8 @@ EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)
{
+ if (ctx == NULL)
+ return;
EVP_CIPHER_CTX_reset(ctx);
OPENSSL_free(ctx);
}
@@ -1608,7 +1610,7 @@ void EVP_CIPHER_free(EVP_CIPHER *cipher)
{
int i;
- if (cipher == NULL)
+ if (cipher == NULL || cipher->prov == NULL)
return;
CRYPTO_DOWN_REF(&cipher->refcnt, &i, cipher->lock);