BUG/MINOR: stktable: missing free in parse_stick_table()
When "peers" keyword is encountered within a stick table definition,
peers.name hint gets replaced with a new copy of the provided name using
strdup(). However, there is no detection on whether the name was
previously set or not, so it is currently allowed to reuse the keyword
multiple time to overwrite previous value, but here we forgot to free
previous value for peers.name before assigning it to a new one.
This should be backported to every stable versions.
(cherry picked from commit 6376fe91427239c8650fba90166de8b0b396cf0b)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 0509b1e0a2b4c7b0150f592b80911219ce3d0ab9)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 69f199474d4546f792e98abe098b36fbf3f95820)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 9d7582c043be17396fe88cc1da0f9bb04222265c)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/stick_table.c b/src/stick_table.c
index cfbb7d8..d351a10 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -829,6 +829,7 @@
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
+ ha_free(&t->peers.name);
t->peers.name = strdup(args[idx++]);
}
else if (strcmp(args[idx], "expire") == 0) {