From 440a5ee78c8592230780310c9c8d8c2ba1700cb1 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 19 Jul 2019 12:13:00 -0300 Subject: Fixed bug for emergency collection in upvalue creation When creating an upvalue, an emergency collection can collect the previous upvalue where the new one would be linked. The following code can trigger the bug, using valgrind on Lua compiled with the -DHARDMEMTESTS option: local x; local y (function () return y end)(); (function () return x end)() --- lfunc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lfunc.h') diff --git a/lfunc.h b/lfunc.h index 0ed79c48..72fc913a 100644 --- a/lfunc.h +++ b/lfunc.h @@ -57,7 +57,7 @@ LUAI_FUNC Proto *luaF_newproto (lua_State *L); LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); -LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); +LUAI_FUNC void luaF_setupval (lua_State *L, StkId level, UpVal **slot); LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level); LUAI_FUNC int luaF_close (lua_State *L, StkId level, int status); LUAI_FUNC void luaF_unlinkupval (UpVal *uv); -- cgit v1.2.3-55-g6feb