From 4d942a3ae6f6bf04cdbbf69c69dffb42c4310ae8 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Sun, 27 Dec 2020 18:52:07 +0000 Subject: [PATCH] fixed more bugs in mod/ffi.c --- moo/mod/ffi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/moo/mod/ffi.c b/moo/mod/ffi.c index 39c61a2..d0f6097 100644 --- a/moo/mod/ffi.c +++ b/moo/mod/ffi.c @@ -328,14 +328,16 @@ static MOO_INLINE int add_ffi_arg (moo_t* moo, ffi_t* ffi, moo_ooch_t fmtc, int newmax = ffi->arg_max + 16; /* TODO: adjust this? */ ttmp = moo_reallocmem(moo, ffi->arg_types, MOO_SIZEOF(*ttmp) * newmax); if (!ttmp) goto oops; + ffi->arg_types = ttmp; + vtmp = moo_reallocmem(moo, ffi->arg_values, MOO_SIZEOF(*vtmp) * newmax); if (!vtmp) goto oops; + ffi->arg_values = vtmp; + stmp = moo_reallocmem(moo, ffi->arg_svs, MOO_SIZEOF(*stmp) * newmax); if (!stmp) goto oops; - - ffi->arg_types = ttmp; - ffi->arg_values = vtmp; ffi->arg_svs = stmp; + ffi->arg_max = newmax; } #endif