]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #650 in SNORT/snort3 from ips_options_lua to master
authorMichael Altizer (mialtize) <mialtize@cisco.com>
Mon, 3 Oct 2016 17:23:18 +0000 (13:23 -0400)
committerMichael Altizer (mialtize) <mialtize@cisco.com>
Mon, 3 Oct 2016 17:23:18 +0000 (13:23 -0400)
Squashed commit of the following:

commit 889f544e06894eb2e91b4511482dd2f36d46a217
Author: Ed Borgoyn <eborgoyn@cisco.com>
Date:   Fri Sep 30 15:50:53 2016 -0400

    Make a copy of the ips_option name to handle static and dynamic strings.

    Change delete -> delete[].

    Change delete[] -> snort_free().

    Changed to have the LuaJitOption perform snort_strdup() and maintain a copy of the name string.

    Fix a nit typo.

src/ips_options/ips_luajit.cc

index 9560fc49c06e1e757e062426e6ff081d67fc7c50..8fd50e71814391b1c224e743ac7755018defd84f 100644 (file)
@@ -38,6 +38,7 @@
 #include "log/messages.h"
 #include "profiler/profiler.h"
 #include "detection/detection_defines.h"
+#include "utils/util.h"
 
 static THREAD_LOCAL ProfileStats luaIpsPerfStats;
 
@@ -127,11 +128,12 @@ private:
 
     std::string config;
     std::vector<Lua::State> states;
+    char* my_name;
 };
 
 LuaJitOption::LuaJitOption(
     const char* name, std::string& chunk, LuaJitModule* mod)
-    : IpsOption(name, RULE_OPTION_TYPE_BUFFER_USE)
+    : IpsOption((my_name = snort_strdup(name)), RULE_OPTION_TYPE_BUFFER_USE)
 {
     // create an args table with any rule options
     config = "args = { ";
@@ -148,7 +150,9 @@ LuaJitOption::LuaJitOption(
 }
 
 LuaJitOption::~LuaJitOption()
-{ }
+{
+    snort_free((void*)my_name);
+}
 
 uint32_t LuaJitOption::hash() const
 {