mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
bug fix - 2fb7d94bd6
This commit is contained in:
parent
d481042480
commit
171419ea88
1 changed files with 7 additions and 4 deletions
|
@ -193,6 +193,8 @@ static void f_luaopen(lua_State *L, void *ud) {
|
|||
g->memerrmsg = luaS_newliteral(L, MEMERRMSG);
|
||||
luaS_fix(g->memerrmsg); /* it should never be collected */
|
||||
g->gcrunning = 1; /* allow gc */
|
||||
g->version = lua_version(NULL);
|
||||
luai_userstateopen(L);
|
||||
}
|
||||
|
||||
|
||||
|
@ -223,6 +225,9 @@ static void close_state(lua_State *L) {
|
|||
global_State *g = G(L);
|
||||
luaF_close(L, L->stack); /* close all upvalues for this thread */
|
||||
luaC_freeallobjects(L); /* collect all objects */
|
||||
if (g->version) /* closing a fully built state? */
|
||||
luai_userstateclose(L);
|
||||
|
||||
luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size);
|
||||
luaZ_freebuffer(L, &g->buff);
|
||||
freestack(L);
|
||||
|
@ -288,7 +293,7 @@ LUA_API lua_State *lua_newstate(lua_Alloc f, void *ud) {
|
|||
setnilvalue(&g->l_registry);
|
||||
luaZ_initbuffer(L, &g->buff);
|
||||
g->panic = NULL;
|
||||
g->version = lua_version(NULL);
|
||||
g->version = NULL;
|
||||
g->gcstate = GCSpause;
|
||||
g->allgc = NULL;
|
||||
g->finobj = NULL;
|
||||
|
@ -306,8 +311,7 @@ LUA_API lua_State *lua_newstate(lua_Alloc f, void *ud) {
|
|||
/* memory allocation error: free partial state */
|
||||
close_state(L);
|
||||
L = NULL;
|
||||
} else
|
||||
luai_userstateopen(L);
|
||||
}
|
||||
return L;
|
||||
}
|
||||
|
||||
|
@ -315,7 +319,6 @@ LUA_API lua_State *lua_newstate(lua_Alloc f, void *ud) {
|
|||
LUA_API void lua_close(lua_State *L) {
|
||||
L = G(L)->mainthread; /* only the main thread can be closed */
|
||||
lua_lock(L);
|
||||
luai_userstateclose(L);
|
||||
close_state(L);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue