From: Victor Julien Date: Thu, 1 Jun 2017 21:49:28 +0000 (+0200) Subject: luajit: cleanup states before return to pool X-Git-Tag: suricata-4.0.0-beta1~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35edc5264d62d20186c435826c224fbd674a4dc9;p=thirdparty%2Fsuricata.git luajit: cleanup states before return to pool --- diff --git a/src/output-lua.c b/src/output-lua.c index 9c34c2648d..16f599aaf5 100644 --- a/src/output-lua.c +++ b/src/output-lua.c @@ -574,8 +574,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