wc_ecc_mulmod_ex(): be more careful freeing temp key.

This commit is contained in:
Daniel Pouzzner
2020-11-26 01:48:04 -06:00
parent e6b587772f
commit 89e6b1eebc

View File

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