]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
FFI: Fix dangling reference to CType.
authorMike Pall <mike>
Mon, 31 May 2021 22:26:45 +0000 (00:26 +0200)
committerMike Pall <mike>
Mon, 31 May 2021 22:26:45 +0000 (00:26 +0200)
src/lj_cconv.c

index 9c1ecdf5a27f65da710e7ff605d7b0945d420360..55a72657b32c9d0221a24873a2e711e968f28c57 100644 (file)
@@ -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;