Fix for ECC curve cache without custom curves enabled.

This commit is contained in:
David Garske
2020-08-27 11:18:55 -07:00
parent 3e685fdb5b
commit 32b46e344d

View File

@ -1304,15 +1304,13 @@ static void wc_ecc_curve_free(ecc_curve_spec* curve)
{ {
if (curve) { if (curve) {
#ifdef ECC_CACHE_CURVE #ifdef ECC_CACHE_CURVE
/* only free custom curves (reset are globally cached) */
if (curve->dp
#ifdef WOLFSSL_CUSTOM_CURVES #ifdef WOLFSSL_CUSTOM_CURVES
&& curve->dp->id == ECC_CURVE_CUSTOM /* only free custom curves (reset are globally cached) */
#endif if (curve->dp && curve->dp->id == ECC_CURVE_CUSTOM) {
) {
wc_ecc_curve_cache_free_spec(curve); wc_ecc_curve_cache_free_spec(curve);
XFREE(curve, NULL, DYNAMIC_TYPE_ECC); XFREE(curve, NULL, DYNAMIC_TYPE_ECC);
} }
#endif
#else #else
wc_ecc_curve_cache_free_spec(curve); wc_ecc_curve_cache_free_spec(curve);
#endif #endif