From 16b842992d1a34189bce8747c4b87451745caf28 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Fri, 27 Oct 2023 13:27:30 -0600 Subject: [PATCH] fix for CID 330416 memory leak --- wolfcrypt/src/hpke.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/hpke.c b/wolfcrypt/src/hpke.c index 9206f5cea..7d293bca2 100644 --- a/wolfcrypt/src/hpke.c +++ b/wolfcrypt/src/hpke.c @@ -785,8 +785,10 @@ static int wc_HpkeEncap(Hpke* hpke, void* ephemeralKey, void* receiverKey, #ifdef ECC_TIMING_RESISTANT rng = wc_rng_new(NULL, 0, hpke->heap); - if (rng == NULL) - return RNG_FAILURE_E; + if (rng == NULL) { + ret = RNG_FAILURE_E; + break; + } wc_ecc_set_rng((ecc_key*)ephemeralKey, rng); #endif