]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
lua_close() segfaults on null pointers
authorTorgeir Natvig <torgeir.natvig@gmail.com>
Wed, 6 Apr 2016 14:08:39 +0000 (16:08 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 7 Apr 2016 13:31:55 +0000 (15:31 +0200)
src/output-lua.c

index 041e83efe78352b8dfa4439a393e3e74b0df4707..c671bc4a687a26c2e08d1a91933d3334c1be4ff1 100644 (file)
@@ -731,7 +731,8 @@ static int LuaScriptInit(const char *filename, LogLuaScriptOptions *options) {
     lua_close(luastate);
     return 0;
 error:
-    lua_close(luastate);
+    if (luastate)
+        lua_close(luastate);
     return -1;
 }
 
@@ -796,7 +797,8 @@ static lua_State *LuaScriptSetup(const char *filename)
     SCLogDebug("lua_State %p is set up", luastate);
     return luastate;
 error:
-    lua_close(luastate);
+    if (luastate)
+        lua_close(luastate);
     return NULL;
 }