]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
luajit: cleanup states before return to pool
authorVictor Julien <victor@inliniac.net>
Thu, 1 Jun 2017 21:49:28 +0000 (23:49 +0200)
committerVictor Julien <victor@inliniac.net>
Sat, 3 Jun 2017 08:41:57 +0000 (10:41 +0200)
src/output-lua.c
src/util-lua.c

index 9c34c2648daa87ebd2550ff32ec663d35ef8b199..16f599aaf5056a67bea3819d09f935e998bcf53d 100644 (file)
@@ -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:
index bc0c20c887158902cf72e2cece97804136e19abe..f03216f85ad264a4c2454f91d358a97df5e95756 100644 (file)
@@ -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