lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I think there is a regression in luac that was introduced in Lua 5.4.4:

We compile several files into a single output file like so

luac -o agenda.luac agenda.lua entry.lua guide.lua location.lua

Up to Lua 5.4.3 there was no issue.  Now with Lua 5.4.4 we get a malloc/free error:

luac -o agenda.luac agenda.lua entry.lua guide.lua location.lua
luac(27853,0x107171600) malloc: *** error for object 0x600001044170: pointer being freed was not allocated
luac(27853,0x107171600) malloc: *** set a breakpoint in malloc_error_break to debug
make: *** [agenda.ext] Abort trap: 6

That is on macOS Monterey, on RHEL 8 it looks like this:

luac -o agenda.luac agenda.lua entry.lua guide.lua location.lua
free(): double free detected in tcache 2

The problem seems to be the call to luaM_freearray(L,f->lineinfo,f->sizelineinfo); on line 158 of luac.c. This is the only call that has been added to the combine() function.  If I comment out that line, things work as expected.