修复创建ip_matcher时导致的内存泄漏。Close #22

This commit is contained in:
zhengchao
2020-06-05 10:24:37 +08:00
parent de9cee06b6
commit 5c304dfe14
2 changed files with 6 additions and 6 deletions

View File

@@ -33,7 +33,7 @@
#include "stream_fuzzy_hash.h" #include "stream_fuzzy_hash.h"
#include "gram_index_engine.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) int is_valid_table_name(const char* str)
{ {

View File

@@ -440,13 +440,13 @@ int Maat_table_runtime_ip_plugin_rebuild_ip_matcher(struct Maat_table_runtime* t
i++; i++;
} }
assert(i==rule_cnt); 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); free(rules);
table_rt->ip_plugin.old_ip_matcher=table_rt->ip_plugin.ip_matcher;
table_rt->ip_plugin.ip_matcher=new_ip_matcher;
return 0; return 0;
} }
struct ip_matcher* Maat_table_runtime_dettach_old_ip_matcher(struct Maat_table_runtime* table_rt) struct ip_matcher* Maat_table_runtime_dettach_old_ip_matcher(struct Maat_table_runtime* table_rt)