MINOR: actions: Add a function pointer to release args used by actions
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.
diff --git a/include/types/action.h b/include/types/action.h
index 33dcd51..01447ef 100644
--- a/include/types/action.h
+++ b/include/types/action.h
@@ -108,6 +108,7 @@
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 {
diff --git a/src/haproxy.c b/src/haproxy.c
index 70d4bed..12d59c3 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -2293,6 +2293,8 @@
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);
}
}