]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: tcp/http: release the expr of set-{src,dst}[-port]
authorWilliam Lallemand <wlallemand@haproxy.org>
Fri, 6 May 2022 14:54:09 +0000 (16:54 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 6 May 2022 15:02:15 +0000 (17:02 +0200)
Release the expression used by the set-{src,dst}[-port] actions so we
keep valgrind happy upon an exit or an haproxy -c.

Could be backported in every supported version.

src/tcp_act.c

index 7608643b376dd12854bef65151de668939d16e8f..354dbc95a3016aa4ca99bce475b02d58e24ec1b8 100644 (file)
@@ -356,6 +356,14 @@ static enum act_return tcp_action_set_tos(struct act_rule *rule, struct proxy *p
 }
 #endif
 
+/*
+ * Release the sample expr when releasing a set src/dst action
+ */
+static void release_set_src_dst_action(struct act_rule *rule)
+{
+       release_sample_expr(rule->arg.expr);
+}
+
 /* parse "set-{src,dst}[-port]" action */
 static enum act_parse_ret tcp_parse_set_src_dst(const char **args, int *orig_arg, struct proxy *px,
                                                 struct act_rule *rule, char **err)
@@ -397,6 +405,7 @@ static enum act_parse_ret tcp_parse_set_src_dst(const char **args, int *orig_arg
                return ACT_RET_PRS_ERR;
        }
 
+       rule->release_ptr = release_set_src_dst_action;
        (*orig_arg)++;
 
        return ACT_RET_PRS_OK;