summaryrefslogtreecommitdiff
path: root/crypto/cms
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-06-14 21:22:55 +1000
committerPauli <pauli@openssl.org>2021-06-15 18:59:44 +1000
commitdfb0b8d63a1b627c5d796ba0174ee4693b330989 (patch)
tree8a2cf68df396005f89b12b490b24d56e92f4cf97 /crypto/cms
parent8dff167dfe5a85932ccb1fc67c8f66af00a616ce (diff)
downloadopenssl-new-dfb0b8d63a1b627c5d796ba0174ee4693b330989.tar.gz
cms: free PKEY_CTX
Preventing a memory leak. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/15731)
Diffstat (limited to 'crypto/cms')
-rw-r--r--crypto/cms/cms_ec.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/cms/cms_ec.c b/crypto/cms/cms_ec.c
index ca66d9fcf8..87ce88e743 100644
--- a/crypto/cms/cms_ec.c
+++ b/crypto/cms/cms_ec.c
@@ -38,6 +38,7 @@ static EVP_PKEY *pkey_type2param(int ptype, const void *pval,
goto err;
}
OSSL_DECODER_CTX_free(ctx);
+ return pkey;
} else if (ptype == V_ASN1_OBJECT) {
const ASN1_OBJECT *poid = pval;
char groupname[OSSL_MAX_NAME_SIZE];
@@ -53,12 +54,12 @@ static EVP_PKEY *pkey_type2param(int ptype, const void *pval,
}
if (EVP_PKEY_paramgen(pctx, &pkey) <= 0)
goto err;
- } else {
- ERR_raise(ERR_LIB_CMS, CMS_R_DECODE_ERROR);
- goto err;
+ EVP_PKEY_CTX_free(pctx);
+ return pkey;
}
- return pkey;
+ ERR_raise(ERR_LIB_CMS, CMS_R_DECODE_ERROR);
+ return NULL;
err:
EVP_PKEY_free(pkey);