Skip to content

Commit

Permalink
luajit: cleanup states before return to pool
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjulien committed Jun 5, 2017
1 parent 994a2fd commit 4a0e4cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/output-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,6 @@ static int LuaScriptInit(const char *filename, LogLuaScriptOptions *options) {
goto error;
}

/* pop the table */
lua_pop(luastate, 1);
LuaReturnState(luastate);
return 0;
error:
Expand Down
4 changes: 4 additions & 0 deletions src/util-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ lua_State *LuaGetState(void)
void LuaReturnState(lua_State *s)
{
if (s != NULL) {
/* clear the stack */
while (lua_gettop(s) > 0) {
lua_pop(s, 1);
}
#ifdef HAVE_LUAJIT
LuajitReturnState(s);
#else
Expand Down

0 comments on commit 4a0e4cb

Please sign in to comment.