]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: actions: Add a function pointer to release args used by actions
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 17 Dec 2019 10:48:42 +0000 (11:48 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 20 Jan 2020 14:18:45 +0000 (15:18 +0100)
Arguments used by actions are never released during HAProxy deinit. Now, it is
possible to specify a function to do so. ".release_ptr" field in the act_rule
structure may be set during the configuration parsing to a specific deinit
function depending on the action type.

include/types/action.h
src/haproxy.c

index 33dcd517d3185e8255788188cca439f016b92988..01447efc3e9a52c5f0f0dc9843deee1f47842730 100644 (file)
@@ -108,6 +108,7 @@ struct act_rule {
        enum act_return (*action_ptr)(struct act_rule *rule, struct proxy *px,  /* ptr to custom action */
                                      struct session *sess, struct stream *s, int flags);
        int (*check_ptr)(struct act_rule *rule, struct proxy *px, char **err); /* ptr to check function */
+       void (*release_ptr)(struct act_rule *rule); /* ptr to release function */
        struct action_kw *kw;
        struct applet applet;                  /* used for the applet registration. */
        union {
index 70d4beda3410fdd9dd31885b0c0fefeb0a04189e..12d59c383365d410ad98e2fb1bae85cf45adeb6b 100644 (file)
@@ -2293,6 +2293,8 @@ static void deinit_act_rules(struct list *rules)
        list_for_each_entry_safe(rule, ruleb, rules, list) {
                LIST_DEL(&rule->list);
                deinit_acl_cond(rule->cond);
+               if (rule->release_ptr)
+                       rule->release_ptr(rule);
                free(rule);
        }
 }