diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-07-18 16:45:50 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-07-18 16:45:50 +0800 |
| commit | 8c596dc1efa8a1267c222b168a4de9c8ba254760 (patch) | |
| tree | 699c748e101a48ae267b5f7b19adbfea15f3934e /src/lua/lauxlib.c | |
| parent | 8ab0038c09a79fa8401bb10b7a31d03ef5380417 (diff) | |
| download | yuescript-8c596dc1efa8a1267c222b168a4de9c8ba254760.tar.gz yuescript-8c596dc1efa8a1267c222b168a4de9c8ba254760.tar.bz2 yuescript-8c596dc1efa8a1267c222b168a4de9c8ba254760.zip | |
fix issue for using return statement with export.
Diffstat (limited to 'src/lua/lauxlib.c')
| -rw-r--r-- | src/lua/lauxlib.c | 6 |
1 files changed, 4 insertions, 2 deletions
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) { | |||
| 475 | lua_Alloc allocf = lua_getallocf(L, &ud); | 475 | lua_Alloc allocf = lua_getallocf(L, &ud); |
| 476 | UBox *box = (UBox *)lua_touserdata(L, idx); | 476 | UBox *box = (UBox *)lua_touserdata(L, idx); |
| 477 | void *temp = allocf(ud, box->box, box->bsize, newsize); | 477 | void *temp = allocf(ud, box->box, box->bsize, newsize); |
| 478 | if (temp == NULL && newsize > 0) /* allocation error? */ | 478 | if (temp == NULL && newsize > 0) { /* allocation error? */ |
| 479 | luaL_error(L, "not enough memory"); | 479 | lua_pushliteral(L, "not enough memory"); |
| 480 | lua_error(L); /* raise a memory error */ | ||
| 481 | } | ||
| 480 | box->box = temp; | 482 | box->box = temp; |
| 481 | box->bsize = newsize; | 483 | box->bsize = newsize; |
| 482 | return temp; | 484 | return temp; |
