From 8c596dc1efa8a1267c222b168a4de9c8ba254760 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Sat, 18 Jul 2020 16:45:50 +0800 Subject: fix issue for using return statement with export. --- src/lua/lauxlib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lua/lauxlib.c') diff --git a/src/lua/lauxlib.c b/src/lua/lauxlib.c index e3d9be3..cbe9ed3 100644 --- a/src/lua/lauxlib.c +++ b/src/lua/lauxlib.c @@ -475,8 +475,10 @@ static void *resizebox (lua_State *L, int idx, size_t newsize) { lua_Alloc allocf = lua_getallocf(L, &ud); UBox *box = (UBox *)lua_touserdata(L, idx); void *temp = allocf(ud, box->box, box->bsize, newsize); - if (temp == NULL && newsize > 0) /* allocation error? */ - luaL_error(L, "not enough memory"); + if (temp == NULL && newsize > 0) { /* allocation error? */ + lua_pushliteral(L, "not enough memory"); + lua_error(L); /* raise a memory error */ + } box->box = temp; box->bsize = newsize; return temp; -- cgit v1.2.3-55-g6feb