FFI: Properly unsink non-standard cdata allocations.

This commit is contained in:
Mike Pall
2015-12-28 13:02:35 +01:00
parent 0345f36153
commit 20f4141b1a
4 changed files with 15 additions and 6 deletions

View File

@@ -49,6 +49,15 @@ GCcdata *lj_cdata_newv(lua_State *L, CTypeID id, CTSize sz, CTSize align)
return cd;
}
/* Allocate arbitrary C data object. */
GCcdata *lj_cdata_newx(CTState *cts, CTypeID id, CTSize sz, CTInfo info)
{
if (!(info & CTF_VLA) && ctype_align(info) <= CT_MEMALIGN)
return lj_cdata_new(cts, id, sz);
else
return lj_cdata_newv(cts->L, id, sz, ctype_align(info));
}
/* Free a C data object. */
void LJ_FASTCALL lj_cdata_free(global_State *g, GCcdata *cd)
{