From 905f0b1f5a5ae9556a1998e984c176c1880fd91e Mon Sep 17 00:00:00 2001 From: Guido Vranken Date: Fri, 22 Jan 2021 09:55:30 +0100 Subject: [PATCH] Fix wc_ecc_sign_hash memory leak. ZD 11556. --- wolfcrypt/src/ecc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index f625e09d5..4bc592a35 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -5149,6 +5149,8 @@ int wc_ecc_sign_hash(const byte* in, word32 inlen, byte* out, word32 *outlen, err = wc_ecc_sign_hash_ex(in, inlen, rng, key, r, s); #endif if (err < 0) { + mp_clear(r); + mp_clear(s); #ifdef WOLFSSL_SMALL_STACK XFREE(s, key->heap, DYNAMIC_TYPE_ECC); XFREE(r, key->heap, DYNAMIC_TYPE_ECC);