From: Pauli Date: Thu, 18 Mar 2021 23:43:24 +0000 (+1000) Subject: evp: fix coverity 1473378: unchecked return value X-Git-Tag: openssl-3.0.0-alpha14~127 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8eca93f8fbd568df3431c449e2b53d4a3aa5bae4;p=thirdparty%2Fopenssl.git evp: fix coverity 1473378: unchecked return value Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14615) --- diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index 4abecdf30c3..94a83c48041 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -846,8 +846,9 @@ static const ECX_KEY *evp_pkey_get0_ECX_KEY(const EVP_PKEY *pkey, int type) static ECX_KEY *evp_pkey_get1_ECX_KEY(EVP_PKEY *pkey, int type) { ECX_KEY *ret = (ECX_KEY *)evp_pkey_get0_ECX_KEY(pkey, type); - if (ret != NULL) - ossl_ecx_key_up_ref(ret); + + if (ret != NULL && !ossl_ecx_key_up_ref(ret)) + ret = NULL; return ret; }