diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index b7d43c33d1..02a6e1d424 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -13661,10 +13661,12 @@ Aes* wc_AesNew_Label(const char* label, void* heap, int devId, int wc_AesDelete(Aes *aes, Aes** aes_p) { + void* heap; if (aes == NULL) return BAD_FUNC_ARG; + heap = aes->heap; wc_AesFree(aes); - XFREE(aes, aes->heap, DYNAMIC_TYPE_AES); + XFREE(aes, heap, DYNAMIC_TYPE_AES); if (aes_p != NULL) *aes_p = NULL; return 0; diff --git a/wolfcrypt/src/hash.c b/wolfcrypt/src/hash.c index b500d2145e..86a01999a1 100644 --- a/wolfcrypt/src/hash.c +++ b/wolfcrypt/src/hash.c @@ -866,12 +866,14 @@ wc_HashAlg* wc_HashNew(enum wc_HashType type, void* heap, int devId, int wc_HashDelete(wc_HashAlg *hash, wc_HashAlg **hash_p) { int ret; + void* heap; if (hash == NULL) return BAD_FUNC_ARG; + heap = hash->heap; ret = wc_HashFree(hash, hash->type); if (ret < 0) return ret; - XFREE(hash, hash->heap, DYNAMIC_TYPE_HASHES); + XFREE(hash, heap, DYNAMIC_TYPE_HASHES); if (hash_p != NULL) *hash_p = NULL; return 0; diff --git a/wolfcrypt/src/wc_mlkem.c b/wolfcrypt/src/wc_mlkem.c index 95fa76e0f8..74c4260a1c 100644 --- a/wolfcrypt/src/wc_mlkem.c +++ b/wolfcrypt/src/wc_mlkem.c @@ -337,10 +337,12 @@ MlKemKey* wc_MlKemKey_New(int type, void* heap, int devId) int wc_MlKemKey_Delete(MlKemKey* key, MlKemKey** key_p) { + void* heap; if (key == NULL) return BAD_FUNC_ARG; + heap = key->heap; wc_MlKemKey_Free(key); - XFREE(key, key->heap, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(key, heap, DYNAMIC_TYPE_TMP_BUFFER); if (key_p != NULL) *key_p = NULL;