From: Aurelien DARRAGON Date: Thu, 1 Jun 2023 07:57:15 +0000 (+0200) Subject: BUG/MINOR: cfgparse-tcp: leak when re-declaring interface from bind line X-Git-Tag: v2.9-dev1~66 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c49224a29df65d81399058d2bb6cd36056915239;p=thirdparty%2Fhaproxy.git BUG/MINOR: cfgparse-tcp: leak when re-declaring interface from bind line When interface keyword is used multiple times within the same bind line, the previous value isn't checked and is rewritten as-is, resulting in a small memory leak. Ensuring the interface name is first freed before assigning it to a new value. This may be backported to every stable versions. [Note for 2.2, the fix must be performed in bind_parse_interface() from proto_tcp.c, directly within the listener's loop, also ha_free() was not available so free() must be used instead] --- diff --git a/src/cfgparse-tcp.c b/src/cfgparse-tcp.c index d753e64e5a..a4f6f29af5 100644 --- a/src/cfgparse-tcp.c +++ b/src/cfgparse-tcp.c @@ -142,6 +142,7 @@ static int bind_parse_interface(char **args, int cur_arg, struct proxy *px, stru return ERR_ALERT | ERR_FATAL; } + ha_free(&conf->settings.interface); conf->settings.interface = strdup(args[cur_arg + 1]); return 0; }