From 0a02218ba36e20a338eee4d31c10e601f11a5594 Mon Sep 17 00:00:00 2001 From: Andras Fekete Date: Mon, 10 Jul 2023 12:37:07 -0400 Subject: [PATCH] Clean up allocated memory on failure --- wolfcrypt/src/port/aria/aria-crypt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wolfcrypt/src/port/aria/aria-crypt.c b/wolfcrypt/src/port/aria/aria-crypt.c index 82bb4ae8e..b958b410c 100644 --- a/wolfcrypt/src/port/aria/aria-crypt.c +++ b/wolfcrypt/src/port/aria/aria-crypt.c @@ -72,6 +72,10 @@ int wc_AriaInitCrypt(wc_Aria* aria, MC_ALGID algo) } if (rv != MC_OK) { + if (aria->hSession != NULL) { + MC_CloseSession(aria->hSession); + aria->hSession = NULL; + } WOLFSSL_MSG(MC_GetErrorString(rv)); return WC_INIT_E; }