From 75348bb29820a10c0afbe754fdd03ceacc91979e Mon Sep 17 00:00:00 2001 From: Shane Lontis Date: Tue, 11 Aug 2020 15:56:17 +1000 Subject: [PATCH] Fix coverity CID #1465525 - NULL pointer dereference in OSSL_DECODER_CTX_new_by_EVP_PKEY() Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/12628) --- crypto/encode_decode/decoder_pkey.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crypto/encode_decode/decoder_pkey.c b/crypto/encode_decode/decoder_pkey.c index e04b94de86..7ab38f228f 100644 --- a/crypto/encode_decode/decoder_pkey.c +++ b/crypto/encode_decode/decoder_pkey.c @@ -369,8 +369,10 @@ OSSL_DECODER_CTX *OSSL_DECODER_CTX_new_by_EVP_PKEY(EVP_PKEY **pkey, data->process_data = NULL; err: - decoder_clean_EVP_PKEY_construct_arg(data->process_data); - sk_OPENSSL_CSTRING_free(data->names); - OPENSSL_free(data); + if (data != NULL) { + decoder_clean_EVP_PKEY_construct_arg(data->process_data); + sk_OPENSSL_CSTRING_free(data->names); + OPENSSL_free(data); + } return ctx; }