Skip to content

Commit 1dddc1d

Browse files
committed
save heap before FreeRsaKey in delete
1 parent aa82c54 commit 1dddc1d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

wolfcrypt/src/rsa.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,13 @@ RsaKey* wc_NewRsaKey_Label(const char* label, void* heap, int devId,
270270

271271
int wc_DeleteRsaKey(RsaKey* key, RsaKey** key_p)
272272
{
273+
void* heap;
273274
if (key == NULL) {
274275
return BAD_FUNC_ARG;
275276
}
277+
heap = key->heap;
276278
wc_FreeRsaKey(key);
277-
XFREE(key, key->heap, DYNAMIC_TYPE_RSA);
279+
XFREE(key, heap, DYNAMIC_TYPE_RSA);
278280
if (key_p != NULL) {
279281
*key_p = NULL;
280282
}

0 commit comments

Comments
 (0)