Fixed some bugs around stack reallocation

Long time without using HARDSTACKTESTS...
This commit is contained in:
Roberto Ierusalimschy
2021-02-05 11:00:28 -03:00
parent e500892e18
commit 2bfa13e520
4 changed files with 6 additions and 1 deletions

View File

@@ -190,9 +190,11 @@ void luaF_close (lua_State *L, StkId level, int status, int yy) {
UpVal *uv;
StkId upl; /* stack index pointed by 'uv' */
if (unlikely(status == LUA_ERRMEM && L->ptbc != NULL)) {
ptrdiff_t levelrel = savestack(L, level);
upl = L->ptbc;
L->ptbc = NULL; /* remove from "list" before closing */
prepcallclosemth(L, upl, status, yy);
level = restorestack(L, levelrel);
}
else
lua_assert(L->ptbc == NULL); /* must be empty for other status */