Fix for CID 299748 memory leak in error case

pull/6922/head
JacobBarthelmeh 2023-10-27 14:36:51 -06:00
parent ef50cb3f02
commit 33c4054cbb
1 changed files with 6 additions and 2 deletions

View File

@ -6107,11 +6107,15 @@ static int wc_PKCS7_KariGenerateKEK(WC_PKCS7_KARI* kari, WC_RNG* rng,
(!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION != 2))) && \
!defined(HAVE_SELFTEST)
ret = wc_ecc_set_rng(kari->senderKey, rng);
if (ret != 0)
if (ret != 0) {
XFREE(secret, kari->heap, DYNAMIC_TYPE_PKCS7);
return ret;
}
ret = wc_ecc_set_rng(kari->recipKey, rng);
if (ret != 0)
if (ret != 0) {
XFREE(secret, kari->heap, DYNAMIC_TYPE_PKCS7);
return ret;
}
#else
(void)rng;
#endif