wc_ecc_mulmod_ex(): be more careful freeing temp key.

pull/3522/head
Daniel Pouzzner 2020-11-26 01:48:04 -06:00
parent e6b587772f
commit 89e6b1eebc
1 changed files with 4 additions and 2 deletions

View File

@ -3007,8 +3007,10 @@ exit:
}
#ifdef WOLFSSL_SMALL_STACK_CACHE
if (key) {
R->key = NULL;
ecc_key_tmp_final(key, heap);
if (R)
R->key = NULL;
if (err == MP_OKAY)
ecc_key_tmp_final(key, heap);
XFREE(key, heap, DYNAMIC_TYPE_ECC);
}
#endif /* WOLFSSL_SMALL_STACK_CACHE */