From 4a0e4cbbfb40cdf71b55db9a79dfbe7da23047c1 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 1 Jun 2017 23:49:28 +0200 Subject: [PATCH] luajit: cleanup states before return to pool --- src/output-lua.c | 2 -- src/util-lua.c | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/output-lua.c b/src/output-lua.c index aedb0031d5..3d083e57d3 100644 --- a/src/output-lua.c +++ b/src/output-lua.c @@ -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: diff --git a/src/util-lua.c b/src/util-lua.c index bc0c20c887..f03216f85a 100644 --- a/src/util-lua.c +++ b/src/util-lua.c @@ -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 -- 2.47.2