修复删除FQDN Plugin配置时产生的内存泄露。

This commit is contained in:
zhengchao
2020-10-19 16:11:25 +08:00
parent 331e1a6380
commit dda54b519e
3 changed files with 9 additions and 4 deletions

View File

@@ -775,6 +775,12 @@ static struct bool_matcher* Maat_hierarchy_build_bool_matcher(struct Maat_hierar
//STEP 3, serial clause states to a bool expression array. //STEP 3, serial clause states to a bool expression array.
compile_num=HASH_COUNT(hier->hash_compile_by_id); compile_num=HASH_COUNT(hier->hash_compile_by_id);
if(compile_num==0)
{
MESA_handle_runtime_log(hier->logger, RLOG_LV_FATAL, module_maat_hierarchy,
"No compile to build.");
return NULL;
}
bool_expr_array=ALLOC(struct bool_expr, compile_num); bool_expr_array=ALLOC(struct bool_expr, compile_num);
HASH_ITER(hh, hier->hash_compile_by_id, compile, tmp_compile) HASH_ITER(hh, hier->hash_compile_by_id, compile, tmp_compile)
{ {
@@ -806,7 +812,7 @@ static struct bool_matcher* Maat_hierarchy_build_bool_matcher(struct Maat_hierar
if(expr_cnt==0) if(expr_cnt==0)
{ {
MESA_handle_runtime_log(hier->logger, RLOG_LV_FATAL, module_maat_hierarchy, MESA_handle_runtime_log(hier->logger, RLOG_LV_FATAL, module_maat_hierarchy,
"No expr to build."); "No bool expression to build.");
return NULL; return NULL;
} }
bm=bool_matcher_new(bool_expr_array, expr_cnt, hier->thread_num, &mem_size); bm=bool_matcher_new(bool_expr_array, expr_cnt, hier->thread_num, &mem_size);

View File

@@ -56,7 +56,7 @@ extern "C"
} }
#endif #endif
int MAAT_FRAME_VERSION_3_0_20200927=1; int MAAT_FRAME_VERSION_3_0_20201019=1;
int is_valid_table_name(const char* str) int is_valid_table_name(const char* str)
{ {

View File

@@ -469,11 +469,10 @@ void Maat_table_runtime_fqdn_plugin_new_row(struct Maat_table_runtime* table_rt,
fqdn_plugin_schema->fqdn_column, row); fqdn_plugin_schema->fqdn_column, row);
return; return;
} }
fqdn_rule=fqdn_rule_new((unsigned int)atoi(row+row_id_offset), row+fqdn_offset, fqdn_len, atoi(row+is_suffix_flag_offset));
if(atoi(row+is_valid_offset)==1)//add if(atoi(row+is_valid_offset)==1)//add
{ {
fqdn_rule=fqdn_rule_new((unsigned int)atoi(row+row_id_offset), row+fqdn_offset, fqdn_len, atoi(row+is_suffix_flag_offset));
EX_data_rt_row2EX_data(fqdn_plugin_rt->ex_data_rt, row, row+row_id_offset, row_id_len, fqdn_rule, logger); EX_data_rt_row2EX_data(fqdn_plugin_rt->ex_data_rt, row, row+row_id_offset, row_id_len, fqdn_rule, logger);
} }
else else