From: Michael Altizer (mialtize) Date: Mon, 3 Oct 2016 17:23:18 +0000 (-0400) Subject: Merge pull request #650 in SNORT/snort3 from ips_options_lua to master X-Git-Tag: 3.0.0-233~243 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b84711b73b133ca0597848982c125cf76a60e331;p=thirdparty%2Fsnort3.git Merge pull request #650 in SNORT/snort3 from ips_options_lua to master Squashed commit of the following: commit 889f544e06894eb2e91b4511482dd2f36d46a217 Author: Ed Borgoyn 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. --- diff --git a/src/ips_options/ips_luajit.cc b/src/ips_options/ips_luajit.cc index 9560fc49c..8fd50e718 100644 --- a/src/ips_options/ips_luajit.cc +++ b/src/ips_options/ips_luajit.cc @@ -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 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 {