From 1dcd6b92a0f602cf360adf59f35b67742d404dc9 Mon Sep 17 00:00:00 2001 From: Kaleb Himes Date: Fri, 8 Mar 2019 15:13:38 -0700 Subject: [PATCH] Fix leak in wolfcrypt test app detected w/ WC_RSA_NO_PADDING set (#2145) Fix leak in wolfCrypt test with `WC_RSA_NO_PADDING` --- wolfcrypt/test/test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 217a396a4..3fafdef98 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -10111,7 +10111,7 @@ int rsa_no_pad_test(void) || out == NULL || plain == NULL #endif ) { - return -6900; + ERROR_OUT(-6900, exit_rsa_nopadding); } #ifdef USE_CERT_BUFFERS_1024 @@ -10268,6 +10268,9 @@ int rsa_no_pad_test(void) ret = 0; exit_rsa_nopadding: + XFREE(tmp, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER); + FREE_VAR(out, HEAP_HINT); + FREE_VAR(plain, HEAP_HINT); wc_FreeRsaKey(&key); wc_FreeRng(&rng);