Fix error message generation for OOM error.

This commit is contained in:
Mike Pall 2010-02-28 22:22:45 +01:00
parent 8cc50cf6b1
commit 89c90f0955
2 changed files with 3 additions and 2 deletions

View File

@ -737,6 +737,7 @@ LJ_NOINLINE void lj_err_mem(lua_State *L)
{
if (L->status == LUA_ERRERR+1) /* Don't touch the stack during lua_open. */
lj_vm_unwind_c(L->cframe, LUA_ERRMEM);
L->top = L->base;
setstrV(L, L->top++, lj_err_str(L, LJ_ERR_ERRMEM));
lj_err_throw(L, LUA_ERRMEM);
}

View File

@ -746,7 +746,7 @@ void *lj_mem_realloc(lua_State *L, void *p, MSize osz, MSize nsz)
lua_assert((osz == 0) == (p == NULL));
p = g->allocf(g->allocd, p, osz, nsz);
if (p == NULL && nsz > 0)
lj_err_throw(L, LUA_ERRMEM);
lj_err_mem(L);
lua_assert((nsz == 0) == (p == NULL));
lua_assert(checkptr32(p));
g->gc.total = (g->gc.total - osz) + nsz;
@ -759,7 +759,7 @@ void *lj_mem_newgco(lua_State *L, MSize size)
global_State *g = G(L);
GCobj *o = (GCobj *)g->allocf(g->allocd, NULL, 0, size);
if (o == NULL)
lj_err_throw(L, LUA_ERRMEM);
lj_err_mem(L);
lua_assert(checkptr32(o));
g->gc.total += size;
setgcrefr(o->gch.nextgc, g->gc.root);