修复多处内存泄漏。

This commit is contained in:
zhengchao
2018-11-29 16:24:45 +08:00
parent bcfed2bab1
commit f76a8c5ca2
7 changed files with 48 additions and 28 deletions

View File

@@ -463,6 +463,7 @@ void http_repl_ctx_free(struct replace_ctx* rep_ctx)
FREE(&(rep_ctx->rule[i].find));
FREE(&(rep_ctx->rule[i].replace_with));
}
FREE(&(rep_ctx->rule));
if (rep_ctx->http_body)
{
evbuffer_free(rep_ctx->http_body);
@@ -939,7 +940,7 @@ enum pangu_action http_scan(const struct tfe_http_session * session, enum tfe_ht
break;
}
const char * str_field_name = http_field_to_string(&field_name);
const char * str_field_name = http_field_name_to_string(&field_name);
scan_ret = Maat_set_scan_status(g_pangu_rt->maat, &(ctx->scan_mid), MAAT_SET_SCAN_DISTRICT,
str_field_name, strlen(str_field_name));

View File

@@ -709,7 +709,7 @@ void hf_private_destory(struct http_half_private * hf_private)
TAILQ_FOREACH_SAFE(header_iter, &hf_private->header_list, next, header_titer)
{
TAILQ_REMOVE(&hf_private->header_list, header_iter, next);
free(header_iter->field);
http_field_name_destory(header_iter->field);
free(header_iter->value);
free(header_iter);
}
@@ -1110,7 +1110,7 @@ void hf_private_construct(struct http_half_private * hf_private)
for (const char * str_value = tfe_http_field_iterate(hf_public, &iterator, &field_name);
str_value != NULL; str_value = tfe_http_field_iterate(hf_public, &iterator, &field_name))
{
const char * str_field = http_field_to_string(&field_name);
const char * str_field = http_field_name_to_string(&field_name);
evbuffer_add_printf(hf_private->evbuf_raw, "%s: %s\r\n", str_field, str_value);
}