From 6376fe91427239c8650fba90166de8b0b396cf0b Mon Sep 17 00:00:00 2001 From: Aurelien DARRAGON Date: Thu, 2 Nov 2023 09:18:55 +0100 Subject: [PATCH] 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. --- src/stick_table.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/stick_table.c b/src/stick_table.c index 3f98d6e5d..bee91130a 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -995,6 +995,7 @@ int parse_stick_table(const char *file, int linenum, char **args, 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) {