From 087fa7cbecc1f92d35d1fb40a8b855af30adc5e7 Mon Sep 17 00:00:00 2001 From: Guido Vranken Date: Thu, 13 Aug 2020 19:22:36 +0200 Subject: [PATCH] In wc_PKCS12_PBKDF_ex, free outer loop variable if inner loop fails --- wolfcrypt/src/pwdbased.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/pwdbased.c b/wolfcrypt/src/pwdbased.c index 541ebca67..5a8251550 100644 --- a/wolfcrypt/src/pwdbased.c +++ b/wolfcrypt/src/pwdbased.c @@ -501,7 +501,10 @@ int wc_PKCS12_PBKDF_ex(byte* output, const byte* passwd, int passLen, if (ret < 0) break; } - if (ret < 0) break; + if (ret < 0) { + mp_clear(&B1); + break; + } currentLen = min(kLen, (int)u); XMEMCPY(output, Ai, currentLen);