]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: server: free the sample expression when it is not usable on a server
authorMartin Mirchev <mirchevmartin2203@gmail.com>
Wed, 28 Oct 2026 14:08:10 +0000 (22:08 +0800)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 28 Oct 2026 14:24:16 +0000 (15:24 +0100)
commit8c84ab5621f52112ccd9a704cfd023faf595e469
tree6d39749dc97328e4b9791e16a064730f735a7ffc
parent7efd0b7ada8558cbecd137c1c8d8097d2d8916f6
BUG/MINOR: server: free the sample expression when it is not usable on a server

parse_srv_expr() parses the "sni" and "pool-conn-name" expressions of a
server. When the fetch cannot be used on a server connection (e.g. a
fetch that needs a response such as "res.hdr(host)"), it reports an error
and returns without releasing the expression it has just allocated.

At startup this is harmless since the process exits on the error, but the
same function is used by the "add server" CLI command. Each rejected
"add server ... sni <expr>" leaks the expression (about 200 bytes per
command, as reported by valgrind), so a script or an operator repeatedly
issuing such commands slowly increases the process' memory usage. Only
admin-level CLI users can trigger it.

This fixes GitHub issue #3547.

This must be backported to all stable versions starting with 3.0, where
the code was introduced by commit 91001422b4 ("MINOR: server: generalize
sni expr parsing").
src/server.c