Fix error handling in CMS_EncryptedData_encrypt
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Thu, 7 Sep 2023 16:05:44 +0000 (18:05 +0200)
committerTomas Mraz <tomas@openssl.org>
Mon, 6 May 2024 08:13:20 +0000 (10:13 +0200)
commit6d2a01cdfb56fdb8ea5d5dd417724e6906c8b8e2
tree12682e21834812c3de91f6142e1f6dfd8c9f147b
parentfedbfff42d790c7b7824351c35b4823c75da6417
Fix error handling in CMS_EncryptedData_encrypt

That caused several memory leaks in case of error.
Also when the CMS object that is created by CMS_EncryptedData_encrypt
is not used in the normal way, but instead just deleted
by CMS_ContentInfo_free some memory was lost.

Fixes #21985

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22031)
crypto/cms/cms_asn1.c
crypto/cms/cms_env.c
crypto/cms/cms_lib.c
crypto/cms/cms_local.h
crypto/cms/cms_sd.c
crypto/cms/cms_smime.c
test/recipes/80-test_cms.t