diff options
Diffstat (limited to 'crypto/evp/kdf_meth.c')
-rw-r--r-- | crypto/evp/kdf_meth.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/crypto/evp/kdf_meth.c b/crypto/evp/kdf_meth.c index 1caf1c579c..5c2ac46f4e 100644 --- a/crypto/evp/kdf_meth.c +++ b/crypto/evp/kdf_meth.c @@ -25,18 +25,20 @@ static int evp_kdf_up_ref(void *vkdf) return 1; } -static void evp_kdf_free(void *vkdf){ +static void evp_kdf_free(void *vkdf) +{ EVP_KDF *kdf = (EVP_KDF *)vkdf; int ref = 0; - if (kdf != NULL) { - CRYPTO_DOWN_REF(&kdf->refcnt, &ref, kdf->lock); - if (ref <= 0) { - ossl_provider_free(kdf->prov); - CRYPTO_THREAD_lock_free(kdf->lock); - OPENSSL_free(kdf); - } - } + if (kdf == NULL) + return; + + CRYPTO_DOWN_REF(&kdf->refcnt, &ref, kdf->lock); + if (ref > 0) + return; + ossl_provider_free(kdf->prov); + CRYPTO_THREAD_lock_free(kdf->lock); + OPENSSL_free(kdf); } static void *evp_kdf_new(void) |