From 28e8f025258d346851ce4b7b7f86485b2ee7828a Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 26 Jul 2021 09:56:29 -0700 Subject: [PATCH] Fix for `wc_ecc_ctx_free` and heap hint. Fixes #4246. --- wolfcrypt/src/ecc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/ecc.c b/wolfcrypt/src/ecc.c index 83256a893..2e7069317 100644 --- a/wolfcrypt/src/ecc.c +++ b/wolfcrypt/src/ecc.c @@ -11171,8 +11171,10 @@ ecEncCtx* wc_ecc_ctx_new(int flags, WC_RNG* rng) void wc_ecc_ctx_free(ecEncCtx* ctx) { if (ctx) { + void* heap = ctx->heap; ForceZero(ctx, sizeof(ecEncCtx)); - XFREE(ctx, ctx->heap, DYNAMIC_TYPE_ECC); + XFREE(ctx, heap, DYNAMIC_TYPE_ECC); + (void)heap; } }