coverity #1486531: return error properly from x509_pubkey_ex_new_ex()

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15942)
This commit is contained in:
Tomas Mraz 2021-06-28 17:09:08 +02:00
parent 69e14a546d
commit 475c5bbd10

View File

@ -116,6 +116,7 @@ static int x509_pubkey_ex_new_ex(ASN1_VALUE **pval, const ASN1_ITEM *it,
|| !x509_pubkey_ex_populate((ASN1_VALUE **)&ret, NULL)
|| !x509_pubkey_set0_libctx(ret, libctx, propq)) {
x509_pubkey_ex_free((ASN1_VALUE **)&ret, NULL);
ret = NULL;
ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
} else {
*pval = (ASN1_VALUE *)ret;