From ff669985750def807d53c24c86b40603a8420762 Mon Sep 17 00:00:00 2001 From: Andras Fekete Date: Mon, 9 Dec 2024 16:24:38 -0500 Subject: [PATCH] Fix memory leak --- wolfcrypt/src/port/aria/aria-cryptocb.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/port/aria/aria-cryptocb.c b/wolfcrypt/src/port/aria/aria-cryptocb.c index cd9ed74376..e6d1b95030 100644 --- a/wolfcrypt/src/port/aria/aria-cryptocb.c +++ b/wolfcrypt/src/port/aria/aria-cryptocb.c @@ -558,8 +558,10 @@ int wc_AriaDerive(ecc_key* private_key, ecc_key* public_key, (ret == WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE))) ret = wc_AriaFree(&(info->hash.sha256->hSession),NULL); } - if (ret != 0) + if (ret != 0) { + wc_AriaFree(&(info->hash.sha256->hSession),NULL); ret = CRYPTOCB_UNAVAILABLE; + } /* reset devId */ info->hash.sha256->devId = devIdArg; } @@ -590,7 +592,10 @@ int wc_AriaDerive(ecc_key* private_key, ecc_key* public_key, ret = wc_AriaFree(&(info->hash.sha384->hSession),NULL); } } - if (ret != 0) ret = CRYPTOCB_UNAVAILABLE; + if (ret != 0) { + wc_AriaFree(&(info->hash.sha384->hSession),NULL); + ret = CRYPTOCB_UNAVAILABLE; + } /* reset devId */ info->hash.sha384->devId = devIdArg; }