1.修改HTTP2命中block规则后,页面无法显示问题
2.上次漏提代码对ex_data释放接口
This commit is contained in:
@@ -92,6 +92,7 @@ enum manipulate_profile_table
|
||||
struct manipulate_profile
|
||||
{
|
||||
int profile_id;
|
||||
int ref_cnt;
|
||||
size_t msg_len;
|
||||
char *profile_name;
|
||||
char *profile_msg;
|
||||
@@ -629,8 +630,10 @@ void ma_profile_table_new_cb(int table_id, const char* key, const char* table_li
|
||||
return;
|
||||
}
|
||||
struct manipulate_profile* ply_profile=ALLOC(struct manipulate_profile, 1);
|
||||
memset(ply_profile, 0, sizeof(struct manipulate_profile));
|
||||
|
||||
ply_profile->profile_id=profile_id;
|
||||
ply_profile->ref_cnt=1;
|
||||
if(strcasecmp(formate, "template") == 0)
|
||||
{
|
||||
ply_profile->tpl = ctemplate::Template::GetTemplate(profile_path, ctemplate::DO_NOT_STRIP);
|
||||
@@ -652,16 +655,27 @@ void ma_profile_table_new_cb(int table_id, const char* key, const char* table_li
|
||||
void ma_profile_table_free_cb(int table_id, MAAT_PLUGIN_EX_DATA* ad, long argl, void *argp)
|
||||
{
|
||||
struct manipulate_profile* ply_obj=(struct manipulate_profile*)(*ad);
|
||||
FREE(&ply_obj->profile_type);
|
||||
FREE(&ply_obj->profile_msg);
|
||||
FREE(&ply_obj->profile_name);
|
||||
FREE(&ply_obj);
|
||||
*ad=NULL;
|
||||
ply_obj->ref_cnt--;
|
||||
|
||||
if (ply_obj->ref_cnt==0)
|
||||
{
|
||||
FREE(&ply_obj->profile_type);
|
||||
FREE(&ply_obj->profile_msg);
|
||||
FREE(&ply_obj->profile_name);
|
||||
FREE(&ply_obj);
|
||||
*ad=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void ma_profile_table_free(struct manipulate_profile* ply_obj)
|
||||
{
|
||||
ma_profile_table_free_cb(0, (void **)&ply_obj, 0, NULL);
|
||||
}
|
||||
|
||||
void ma_profile_table_dup_cb(int table_id, MAAT_PLUGIN_EX_DATA *to, MAAT_PLUGIN_EX_DATA *from, long argl, void *argp)
|
||||
{
|
||||
struct manipulate_profile* ply_obj=(struct manipulate_profile*)(*from);
|
||||
ply_obj->ref_cnt++;
|
||||
*to=ply_obj;
|
||||
}
|
||||
|
||||
@@ -892,7 +906,6 @@ struct pangu_http_ctx
|
||||
struct cache_mid* cmid;
|
||||
struct Maat_rule_t * enforce_rules;
|
||||
size_t n_enforce;
|
||||
char * enforce_para;
|
||||
struct policy_action_param *param;
|
||||
struct evbuffer* log_req_body, *log_resp_body;
|
||||
|
||||
@@ -968,7 +981,8 @@ static void pangu_http_ctx_free(struct pangu_http_ctx * ctx)
|
||||
ctx->ins_ctx = NULL;
|
||||
}
|
||||
FREE(&ctx->enforce_rules);
|
||||
FREE(&ctx->enforce_para);
|
||||
policy_action_param_free(ctx->param);
|
||||
ctx->param=NULL;
|
||||
Maat_clean_status(&(ctx->scan_mid));
|
||||
ctx->scan_mid = NULL;
|
||||
|
||||
@@ -1191,8 +1205,10 @@ static int html_generate(int profile_id, const char* msg, char ** page_buff, siz
|
||||
*page_size = block_profile->msg_len;
|
||||
*page_buff = tfe_strdup(block_profile->profile_msg);
|
||||
}
|
||||
ma_profile_table_free(block_profile);
|
||||
block_profile=NULL;
|
||||
return ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void html_free(char ** page_buff)
|
||||
@@ -1523,7 +1539,8 @@ static void http_hijack(const struct tfe_http_session * session, enum tfe_http_e
|
||||
tfe_http_half_append_body(response, NULL, 0, 0);
|
||||
tfe_http_session_response_set(to_write_sess, response);
|
||||
tfe_http_session_detach(session);
|
||||
hijack_profile=NULL;
|
||||
ma_profile_table_free(hijack_profile);
|
||||
hijack_profile = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1543,7 +1560,8 @@ static int format_insert_rule(int profile_id, const char* insert_position, struc
|
||||
|
||||
if (insert_position)
|
||||
rule->position=tfe_strdup(insert_position);
|
||||
insert_profile=NULL;
|
||||
ma_profile_table_free(insert_profile);
|
||||
insert_profile = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user