Skip to content

Commit e852c09

Browse files
committed
wolfssl/wolfcrypt/integer.h: for heapmath FREE_MP_INT_SIZE(), rather than WC_DO_NOTHING(), conditionally mp_free(), for functional isomorphism with sp_int and tfm MPI lifecycles.
1 parent 05ff129 commit e852c09

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

wolfssl/wolfcrypt/integer.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,12 @@ typedef int mp_err;
205205
#define NEW_MP_INT_SIZE(name, bits, heap, type) \
206206
XMEMSET(name, 0, sizeof(mp_int))
207207
/* Dispose of static mp_int. */
208-
#define FREE_MP_INT_SIZE(name, heap, type) WC_DO_NOTHING
208+
#define FREE_MP_INT_SIZE(name, heap, type) \
209+
do { \
210+
if ((name) != NULL) { \
211+
mp_free(name); \
212+
} \
213+
} while (0)
209214
/* Initialize an mp_int. */
210215
#define INIT_MP_INT_SIZE(name, bits) \
211216
mp_init(name)

0 commit comments

Comments
 (0)