From: fennecdjay Date: Tue, 6 Dec 2022 18:45:03 +0000 (+0100) Subject: :art: improve free_captures X-Git-Tag: nightly~207^2~69 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=a28eef3027cc2a5e8556f9a67e6ac21f54946059;p=gwion.git :art: improve free_captures --- diff --git a/src/lib/closure.c b/src/lib/closure.c index 53b4d124..d58ba0ce 100644 --- a/src/lib/closure.c +++ b/src/lib/closure.c @@ -84,15 +84,15 @@ ANN Type upvalue_type(const Env env, Capture *cap) { } ANN void free_captures(const VM_Shred shred, m_bit *const caps) { - uint32_t sz = 0; + uint32_t sz = SZ_INT; const Capture_List captures = (*(Func_Def*)caps)->captures; for(m_uint i = 0; i < captures->len; i++) { Capture *const cap = mp_vector_at(captures, Capture, i); if(tflag(cap->temp->type, tflag_compound)) - compound_release(shred, cap->temp->type, caps + SZ_INT + sz); + compound_release(shred, cap->temp->type, caps + sz); sz += cap->temp->type->size; } - mp_free2(shred->info->mp, sz + SZ_INT, caps); + mp_free2(shred->info->mp, sz, caps); } static INSTR(fptr_capture) {