From 2bfa13e520e53210b96ead88f49a9ca20c5a5d18 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 5 Feb 2021 11:00:28 -0300 Subject: Fixed some bugs around stack reallocation Long time without using HARDSTACKTESTS... --- ldo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ldo.c') diff --git a/ldo.c b/ldo.c index e8cccccb..65f0a7b9 100644 --- a/ldo.c +++ b/ldo.c @@ -412,12 +412,12 @@ static void moveresults (lua_State *L, StkId res, int nres, int wanted) { if (hastocloseCfunc(wanted)) { /* to-be-closed variables? */ ptrdiff_t savedres = savestack(L, res); luaF_close(L, res, CLOSEKTOP, 0); /* may change the stack */ - res = restorestack(L, savedres); wanted = codeNresults(wanted); /* correct value */ if (wanted == LUA_MULTRET) wanted = nres; if (L->hookmask) /* if needed, call hook after '__close's */ rethook(L, L->ci, nres); + res = restorestack(L, savedres); /* close and hook can move stack */ } break; } -- cgit v1.2.3-55-g6feb