Merge pull request #3678 from guidovranken/zd11556

Fix wc_ecc_sign_hash memory leak. ZD 11556.
pull/3683/head
David Garske 2021-01-22 18:06:56 -08:00 committed by GitHub
commit fb9836ed28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -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);