diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2023-11-17 07:12:42 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2023-11-22 09:32:49 +0100 |
commit | 757d6491ebebc541f54c0aa8043b8e5b31a58a7e (patch) | |
tree | 69a144f6544b082fac17b0617af7cae41f96e529 | |
parent | f06d4082394d4fd6d9ba96a441bbb1c6ef524020 (diff) |
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)
(cherry picked from commit 3e3aadd51cae1fbfb512cf4a0999d16c6a2888bd)
-rw-r--r-- | crypto/cms/cms_smime.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c index 65f9674037..99a72f4dff 100644 --- a/crypto/cms/cms_smime.c +++ b/crypto/cms/cms_smime.c @@ -560,7 +560,7 @@ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, { CMS_SignerInfo *rct_si; CMS_ContentInfo *cms = NULL; - ASN1_OCTET_STRING **pos, *os; + ASN1_OCTET_STRING **pos, *os = NULL; BIO *rct_cont = NULL; int r = 0; const CMS_CTX *ctx = si->cms_ctx; @@ -622,6 +622,7 @@ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, if (r) return cms; CMS_ContentInfo_free(cms); + ASN1_OCTET_STRING_free(os); return NULL; } |