From: Christopher Faulet Date: Fri, 24 Jan 2020 17:12:58 +0000 (+0100) Subject: MINOR: dns: Add function to release memory allocated for a do-resolve rule X-Git-Tag: v2.2-dev2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b2bb63ded00fea8525b3fc29e6bb30671b272c7;p=thirdparty%2Fhaproxy.git MINOR: dns: Add function to release memory allocated for a do-resolve rule Memory allocated when a do-resolve rule is parsed is now released when HAProxy exits. --- diff --git a/src/dns.c b/src/dns.c index bd2c9638ea..f823018577 100644 --- a/src/dns.c +++ b/src/dns.c @@ -2482,6 +2482,14 @@ enum act_return dns_action_do_resolve(struct act_rule *rule, struct proxy *px, return ACT_RET_YIELD; } +static void release_dns_action(struct act_rule *rule) +{ + release_sample_expr(rule->arg.dns.expr); + free(rule->arg.dns.varname); + free(rule->arg.dns.resolvers_id); + free(rule->arg.dns.dns_opts); +} + /* parse "do-resolve" action * This action takes the following arguments: @@ -2588,6 +2596,7 @@ enum act_parse_ret dns_parse_do_resolve(const char **args, int *orig_arg, struct *orig_arg = cur_arg; rule->check_ptr = check_action_do_resolve; + rule->release_ptr = release_dns_action; return ACT_RET_PRS_OK;