mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
Fix a possible memleak in CMS_sign_receipt
When an error happens after cms_encode_Receipt the ASN1_OCTET_STRING object "os" may be leaked. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22758)
This commit is contained in:
parent
ed3d277127
commit
3e3aadd51c
@ -560,7 +560,7 @@ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
|
|||||||
{
|
{
|
||||||
CMS_SignerInfo *rct_si;
|
CMS_SignerInfo *rct_si;
|
||||||
CMS_ContentInfo *cms = NULL;
|
CMS_ContentInfo *cms = NULL;
|
||||||
ASN1_OCTET_STRING **pos, *os;
|
ASN1_OCTET_STRING **pos, *os = NULL;
|
||||||
BIO *rct_cont = NULL;
|
BIO *rct_cont = NULL;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
const CMS_CTX *ctx = si->cms_ctx;
|
const CMS_CTX *ctx = si->cms_ctx;
|
||||||
@ -622,6 +622,7 @@ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
|
|||||||
if (r)
|
if (r)
|
||||||
return cms;
|
return cms;
|
||||||
CMS_ContentInfo_free(cms);
|
CMS_ContentInfo_free(cms);
|
||||||
|
ASN1_OCTET_STRING_free(os);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user