diff options
Diffstat (limited to 'crypto/cms/cms_env.c')
-rw-r--r-- | crypto/cms/cms_env.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c index b9775e0ad2..a9a9d84e60 100644 --- a/crypto/cms/cms_env.c +++ b/crypto/cms/cms_env.c @@ -236,7 +236,7 @@ CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, if (!ri) goto merr; - pk = X509_get_pubkey(recip); + pk = X509_get0_pubkey(recip); if (!pk) { CMSerr(CMS_F_CMS_ADD1_RECIPIENT_CERT, CMS_R_ERROR_GETTING_PUBLIC_KEY); goto err; @@ -264,15 +264,12 @@ CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, if (!sk_CMS_RecipientInfo_push(env->recipientInfos, ri)) goto merr; - EVP_PKEY_free(pk); - return ri; merr: CMSerr(CMS_F_CMS_ADD1_RECIPIENT_CERT, ERR_R_MALLOC_FAILURE); err: M_ASN1_free_of(ri, CMS_RecipientInfo); - EVP_PKEY_free(pk); return NULL; } |