From 9001036e0926dfa2d4352b2aa3330901e6839495 Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 4 May 2016 23:14:59 -0700 Subject: [PATCH] Fixes memory leak in the wc_RsaFunction if failure happens when using normal math (not fast math) and RSA_LOW_MEM is not defined. --- wolfcrypt/src/rsa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/rsa.c b/wolfcrypt/src/rsa.c index 690a7c804..7dd775809 100644 --- a/wolfcrypt/src/rsa.c +++ b/wolfcrypt/src/rsa.c @@ -845,7 +845,9 @@ static int wc_RsaFunction(const byte* in, word32 inLen, byte* out, mp_clear(&tmpa); mp_clear(&tmpb); - if (ret != 0) return ret; + if (ret != 0) { + goto done; + } #endif /* RSA_LOW_MEM */ }