[PATCH]fix potential memory leaks

This commit is contained in:
liuwentan
2023-10-27 17:31:35 +08:00
parent 9f7c82e6b0
commit 9b5a07ecc6
12 changed files with 29 additions and 9 deletions

View File

@@ -300,10 +300,12 @@ void *adapter_rs_new(struct expr_rule *rules, size_t n_rule,
if (literal_cd != NULL) {
adpt_rs_compile_data_free(literal_cd);
literal_cd = NULL;
}
if (regex_cd != NULL) {
adpt_rs_compile_data_free(regex_cd);
regex_cd = NULL;
}
if (rs_ret < 0) {
@@ -385,6 +387,7 @@ void adapter_rs_free(void *rs_instance)
for (i = 0; i < rs_inst->n_worker_thread; i++) {
if (rs_inst->rs_rt->matched_pats[i] != NULL) {
utarray_free(rs_inst->rs_rt->matched_pats[i]->pattern_ids);
rs_inst->rs_rt->matched_pats[i]->pattern_ids = NULL;
FREE(rs_inst->rs_rt->matched_pats[i]);
}
}