]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: acl: remove duplicate test in parse_acl_expr() and unused variable
authorWilly Tarreau <w@1wt.eu>
Thu, 30 Apr 2026 13:53:21 +0000 (15:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 30 Apr 2026 15:39:26 +0000 (17:39 +0200)
aclkw->match_type was compared twice to PAT_MATCH_DOM in parse_acl_expr().
After auditing the involved types, it's only a copy-paste mistake, as no
other matching method is missing, so let's drop it to avoid the confusion.
Also drop variable ckw which is assigned NULL and passed to free(), and is
clearly a leftover from a previous version.

No backport needed.

src/acl.c

index 5950da97df9c30753b81511c77242a446b806535..f03c065dc62b178427ccd31acb5ff72157e8abb6 100644 (file)
--- a/src/acl.c
+++ b/src/acl.c
@@ -138,7 +138,6 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
        const char *arg;
        struct sample_expr *smp = NULL;
        int idx = 0;
-       char *ckw = NULL;
        const char *endt;
        int cur_type;
        int nbargs;
@@ -410,7 +409,7 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
        }
 
        if (aclkw) {
-               if (((aclkw->match_type == PAT_MATCH_BEG || aclkw->match_type == PAT_MATCH_DIR || aclkw->match_type == PAT_MATCH_DOM ||
+               if (((aclkw->match_type == PAT_MATCH_BEG || aclkw->match_type == PAT_MATCH_DIR ||
                      aclkw->match_type == PAT_MATCH_DOM || aclkw->match_type == PAT_MATCH_END || aclkw->match_type == PAT_MATCH_LEN ||
                      aclkw->match_type == PAT_MATCH_REG || aclkw->match_type == PAT_MATCH_SUB) &&
                     expr->pat.match != pat_match_fcts[aclkw->match_type]) ||
@@ -593,7 +592,6 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
        prune_acl_expr(expr);
        free(expr);
  out_free_smp:
-       free(ckw);
        free(smp);
  out_return:
        return NULL;