From efa7dd64443f246004751bdaa5671bf6836e07ff Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Fri, 1 May 2015 10:15:18 -0400 Subject: free NULL cleanup 11 Don't check for NULL before calling free functions. This gets: ERR_STATE_free ENGINE_free DSO_free CMAC_CTX_free COMP_CTX_free CONF_free NCONF_free NCONF_free_data _CONF_free_data A sk_free use within OBJ_sigid_free TS_TST_INFO_free (rest of TS_ API was okay) Doc update for UI_free (all uses were fine) X509V3_conf_free X509V3_section_free X509V3_string_free Reviewed-by: Richard Levitte --- crypto/cmac/cm_ameth.c | 3 +-- crypto/cmac/cmac.c | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'crypto/cmac') diff --git a/crypto/cmac/cm_ameth.c b/crypto/cmac/cm_ameth.c index 98634c99e9..07853a63d3 100644 --- a/crypto/cmac/cm_ameth.c +++ b/crypto/cmac/cm_ameth.c @@ -70,8 +70,7 @@ static int cmac_size(const EVP_PKEY *pkey) static void cmac_key_free(EVP_PKEY *pkey) { CMAC_CTX *cmctx = (CMAC_CTX *)pkey->pkey.ptr; - if (cmctx) - CMAC_CTX_free(cmctx); + CMAC_CTX_free(cmctx); } const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = { diff --git a/crypto/cmac/cmac.c b/crypto/cmac/cmac.c index 19018480f2..5e8fdc399b 100644 --- a/crypto/cmac/cmac.c +++ b/crypto/cmac/cmac.c @@ -115,6 +115,8 @@ EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx) void CMAC_CTX_free(CMAC_CTX *ctx) { + if (!ctx) + return; CMAC_CTX_cleanup(ctx); OPENSSL_free(ctx); } -- cgit v1.2.3