]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: dns: Add function to release memory allocated for a do-resolve rule
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 24 Jan 2020 17:12:58 +0000 (18:12 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 6 Feb 2020 13:55:34 +0000 (14:55 +0100)
Memory allocated when a do-resolve rule is parsed is now released when HAProxy
exits.

src/dns.c

index bd2c9638ea0d930bf3c943d75aa7bd3b2fbf9675..f8230185778506a460edb68d6175cd9c0fe3e9f9 100644 (file)
--- 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;