summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhengchao <[email protected]>2020-06-05 10:24:37 +0800
committerzhengchao <[email protected]>2020-06-05 10:24:37 +0800
commit5c304dfe14d6fd7e63d67a84af42120b5a0c23cb (patch)
tree31e8e296837ff6e973055f6e67ff368a050a955b
parentde9cee06b6bb7197b9c4ac7f47a8f73d94936b6f (diff)
修复创建ip_matcher时导致的内存泄漏。Close #22v2.9.1
-rw-r--r--src/entry/Maat_rule.cpp2
-rw-r--r--src/entry/Maat_table_runtime.cpp10
2 files changed, 6 insertions, 6 deletions
diff --git a/src/entry/Maat_rule.cpp b/src/entry/Maat_rule.cpp
index ee19905..e151fa7 100644
--- a/src/entry/Maat_rule.cpp
+++ b/src/entry/Maat_rule.cpp
@@ -33,7 +33,7 @@
#include "stream_fuzzy_hash.h"
#include "gram_index_engine.h"
-int MAAT_FRAME_VERSION_2_9_20200513=1;
+int MAAT_FRAME_VERSION_2_9_20200605=1;
int is_valid_table_name(const char* str)
{
diff --git a/src/entry/Maat_table_runtime.cpp b/src/entry/Maat_table_runtime.cpp
index accdc83..74718b7 100644
--- a/src/entry/Maat_table_runtime.cpp
+++ b/src/entry/Maat_table_runtime.cpp
@@ -440,13 +440,13 @@ int Maat_table_runtime_ip_plugin_rebuild_ip_matcher(struct Maat_table_runtime* t
i++;
}
assert(i==rule_cnt);
- if(rule_cnt==0)
+ if(rule_cnt>0)
{
- return 0;
+ new_ip_matcher=ip_matcher_new(rules, rule_cnt, &mem_use);
+ table_rt->ip_plugin.old_ip_matcher=table_rt->ip_plugin.ip_matcher;
+ table_rt->ip_plugin.ip_matcher=new_ip_matcher;
}
- new_ip_matcher=ip_matcher_new(rules, rule_cnt, &mem_use);
- table_rt->ip_plugin.old_ip_matcher=table_rt->ip_plugin.ip_matcher;
- table_rt->ip_plugin.ip_matcher=new_ip_matcher;
+ free(rules);
return 0;
}
struct ip_matcher* Maat_table_runtime_dettach_old_ip_matcher(struct Maat_table_runtime* table_rt)