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.
This commit is contained in:
Aurelien DARRAGON 2023-11-02 09:18:55 +01:00 committed by Willy Tarreau
parent b9c0b039c8
commit 6376fe9142

View File

@ -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) {