BUG/MINOR: http-rules: Don't free new rule on allocation failure

If allocation of a new HTTP rule fails, we must not release it calling
free_act_rule(). The regression was introduced by the commit dd7e6c6dc
("BUG/MINOR: http-rules: completely free incorrect TCP rules on error").

This patch must only be backported if the commit above is backported. It should
fix the issues #1627, #1628 and #1629.
This commit is contained in:
Christopher Faulet 2022-03-21 08:21:19 +01:00
parent 9075dbdd84
commit ab398d8ff9

View File

@ -99,7 +99,7 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
rule = new_act_rule(ACT_F_HTTP_REQ, file, linenum);
if (!rule) {
ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
goto out_err;
goto out;
}
if (((custom = action_http_req_custom(args[0])) != NULL)) {
@ -164,6 +164,7 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
return rule;
out_err:
free_act_rule(rule);
out:
return NULL;
}
@ -177,7 +178,7 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
rule = new_act_rule(ACT_F_HTTP_RES, file, linenum);
if (!rule) {
ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
goto out_err;
goto out;
}
if (((custom = action_http_res_custom(args[0])) != NULL)) {
@ -242,6 +243,7 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
return rule;
out_err:
free_act_rule(rule);
out:
return NULL;
}
@ -256,7 +258,7 @@ struct act_rule *parse_http_after_res_cond(const char **args, const char *file,
rule = new_act_rule(ACT_F_HTTP_RES, file, linenum);
if (!rule) {
ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
goto out_err;
goto out;
}
if (((custom = action_http_after_res_custom(args[0])) != NULL)) {
@ -311,6 +313,7 @@ struct act_rule *parse_http_after_res_cond(const char **args, const char *file,
return rule;
out_err:
free_act_rule(rule);
out:
return NULL;
}