mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 04:50:12 -07:00
bug fix - c2ea18726a
This commit is contained in:
parent
580e88b245
commit
2f5de9ed0a
1 changed files with 10 additions and 2 deletions
|
@ -490,17 +490,25 @@ static lu_mem traverseLclosure(global_State *g, LClosure *cl) {
|
||||||
|
|
||||||
|
|
||||||
static lu_mem traversestack(global_State *g, lua_State *th) {
|
static lu_mem traversestack(global_State *g, lua_State *th) {
|
||||||
|
int n = 0;
|
||||||
StkId o = th->stack;
|
StkId o = th->stack;
|
||||||
if (o == NULL)
|
if (o == NULL)
|
||||||
return 1; /* stack not completely built yet */
|
return 1; /* stack not completely built yet */
|
||||||
for (; o < th->top; o++)
|
|
||||||
|
for (; o < th->top; o++) /* mark live elements in the stack */
|
||||||
markvalue(g, o);
|
markvalue(g, o);
|
||||||
|
|
||||||
if (g->gcstate == GCSatomic) { /* final traversal? */
|
if (g->gcstate == GCSatomic) { /* final traversal? */
|
||||||
StkId lim = th->stack + th->stacksize; /* real end of stack */
|
StkId lim = th->stack + th->stacksize; /* real end of stack */
|
||||||
for (; o < lim; o++) /* clear not-marked stack slice */
|
for (; o < lim; o++) /* clear not-marked stack slice */
|
||||||
setnilvalue(o);
|
setnilvalue(o);
|
||||||
|
|
||||||
|
} else { /* count call infos to compute size */
|
||||||
|
CallInfo *ci;
|
||||||
|
for (ci = &th->base_ci; ci != th->ci; ci = ci->next)
|
||||||
|
n++;
|
||||||
}
|
}
|
||||||
return sizeof(lua_State) + sizeof(TValue) * th->stacksize;
|
return sizeof(lua_State) + sizeof(TValue) * th->stacksize + sizeof(CallInfo) * n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue