]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: resolvers: Free opts on parse error in resolv_parse_do_resolve()
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 4 May 2026 12:59:24 +0000 (14:59 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 4 May 2026 14:33:56 +0000 (16:33 +0200)
The error handler at do_resolve_parse_error freed varname and resolvers_id
but missed freeing rule->arg.resolv.opts (allocated via calloc). Added
ha_free(&rule->arg.resolv.opts) to the cleanup path.

This patch could be backported to all stable branches.

src/resolvers.c

index de93fea1a19e3641e53a90c8efb3976c5eec4561..0200be4c5e122092eb302b30fb683666bec133cc 100644 (file)
@@ -3403,6 +3403,7 @@ enum act_parse_ret resolv_parse_do_resolve(const char **args, int *orig_arg, str
  do_resolve_parse_error:
        ha_free(&rule->arg.resolv.varname);
        ha_free(&rule->arg.resolv.resolvers_id);
+       ha_free(&rule->arg.resolv.opts);
        memprintf(err, "Can't parse '%s'. Expects 'do-resolve(<varname>,<resolvers>[,<options>]) <expr>'. Available options are 'ipv4' and 'ipv6'",
                        args[cur_arg]);
        return ACT_RET_PRS_ERR;