]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/lua: Unregister Lua object on free
authorJeff Lucovsky <jeff@lucovsky.org>
Fri, 24 Apr 2020 12:56:33 +0000 (08:56 -0400)
committerJeff Lucovsky <jeff@lucovsky.org>
Fri, 24 Apr 2020 14:06:26 +0000 (10:06 -0400)
This commit ensures that the LUA object is unregistered when the Lua
object is freed.

src/detect-lua.c
src/detect-lua.h

index 7f75b6642bc0fb9a849521b920c8007556016371..a43ba4ad73ec6f5d86885c32919564eea5d6f4f2 100644 (file)
@@ -687,6 +687,7 @@ static DetectLuaData *DetectLuaParse (const DetectEngineCtx *de_ctx, const char
         goto error;
     }
 
+    lua->de_ctx = de_ctx;
     return lua;
 
 error:
@@ -1119,6 +1120,10 @@ static void DetectLuaFree(void *ptr)
         if (lua->filename)
             SCFree(lua->filename);
 
+        if (lua->de_ctx) {
+            DetectUnregisterThreadCtxFuncs((DetectEngineCtx *)lua->de_ctx, NULL, lua, "lua");
+        }
+
         SCFree(lua);
     }
 }
index 6a2ce77bea263a3589bbc62640f7c621570f1386..1e0422cf13ed1573318ecd3850ba91b4748330f1 100644 (file)
@@ -49,6 +49,8 @@ typedef struct DetectLuaData {
     uint32_t sid;
     uint32_t rev;
     uint32_t gid;
+
+    const DetectEngineCtx *de_ctx;
 } DetectLuaData;
 
 #endif /* HAVE_LUA */