Browse Source

an error may call GC and find an incomplete `ci'

Roberto Ierusalimschy 23 năm trước cách đây
mục cha
commit
da81845cd5
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      ldo.c

+ 2 - 2
ldo.c

@@ -1,5 +1,5 @@
 /*
 /*
-** $Id: ldo.c,v 1.162 2002/03/08 19:11:03 roberto Exp roberto $
+** $Id: ldo.c,v 1.163 2002/03/11 12:45:00 roberto Exp roberto $
 ** Stack and Call structure of Lua
 ** Stack and Call structure of Lua
 ** See Copyright Notice in lua.h
 ** See Copyright Notice in lua.h
 */
 */
@@ -204,7 +204,7 @@ StkId luaD_precall (lua_State *L, StkId func) {
   LClosure *cl;
   LClosure *cl;
   if (++L->ci == L->end_ci) luaD_reallocCI(L, 2*L->size_ci);
   if (++L->ci == L->end_ci) luaD_reallocCI(L, 2*L->size_ci);
   ci = L->ci;
   ci = L->ci;
-  ci->base = func+1;
+  ci->base = ci->top = func+1;  /* pre-init `top' in case of errors */
   ci->pc = NULL;
   ci->pc = NULL;
   if (ttype(func) != LUA_TFUNCTION) /* `func' is not a function? */
   if (ttype(func) != LUA_TFUNCTION) /* `func' is not a function? */
     func = tryfuncTM(L, func);  /* check the `function' tag method */
     func = tryfuncTM(L, func);  /* check the `function' tag method */