summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2021-06-01 00:26:45 +0200
committerMike Pall <mike>2021-06-01 00:26:45 +0200
commitae533e3a6c009b5df79b11cd5787d249202fa69c (patch)
treed77b878898812e3f7f8d567826885fe657aefa41 /src
parentc2cfa04231785116d9d198462830f41ef94147c0 (diff)
downloadluajit2-ae533e3a6c009b5df79b11cd5787d249202fa69c.tar.gz
FFI: Fix dangling reference to CType.
Diffstat (limited to 'src')
-rw-r--r--src/lj_cconv.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lj_cconv.c b/src/lj_cconv.c
index 9c1ecdf5..55a72657 100644
--- a/src/lj_cconv.c
+++ b/src/lj_cconv.c
@@ -557,7 +557,9 @@ void lj_cconv_ct_tv(CTState *cts, CType *d,
}
s = ctype_raw(cts, sid);
if (ctype_isfunc(s->info)) {
+ CTypeID did = ctype_typeid(cts, d);
sid = lj_ctype_intern(cts, CTINFO(CT_PTR, CTALIGN_PTR|sid), CTSIZE_PTR);
+ d = ctype_get(cts, did); /* cts->tab may have been reallocated. */
} else {
if (ctype_isenum(s->info)) s = ctype_child(cts, s);
goto doconv;