diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index da2a629b8..8ab5e7b78 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -1304,15 +1304,13 @@ static void wc_ecc_curve_free(ecc_curve_spec* curve) { if (curve) { #ifdef ECC_CACHE_CURVE - /* only free custom curves (reset are globally cached) */ - if (curve->dp #ifdef WOLFSSL_CUSTOM_CURVES - && curve->dp->id == ECC_CURVE_CUSTOM - #endif - ) { + /* only free custom curves (reset are globally cached) */ + if (curve->dp && curve->dp->id == ECC_CURVE_CUSTOM) { wc_ecc_curve_cache_free_spec(curve); XFREE(curve, NULL, DYNAMIC_TYPE_ECC); } + #endif #else wc_ecc_curve_cache_free_spec(curve); #endif