]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: resolvers: fix memory leak on AAAA additional records
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Apr 2026 11:06:41 +0000 (13:06 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 9 Apr 2026 14:31:05 +0000 (16:31 +0200)
commitb63cae7f9bda0fd5af0cde04aa5965df0130f53c
tree48b9be4a25bd26e92ec9eecf261a8e44eb0cb9a7
parent0e18e1cc7754d138ba4b517548d54a7a6a2383af
BUG/MINOR: resolvers: fix memory leak on AAAA additional records

Commit c84c15d3938a ("BUG/MINOR: resolvers: Apply dns-accept-family
setting on additional records") converted a switch statement to an
if/else chain but left the break; in the AAAA branch. In the new
form, break exits the surrounding for loop instead of a switch case.

For every AAAA additional record in an SRV response:
  - answer_record allocated at line 1460 is never freed and never
    inserted into answer_tree -> ~580 bytes leaked per response
  - all subsequent additional records in the response are silently
    discarded

A DNS server controlling SRV responses for haproxy service discovery
can leak memory at MB/min rates given default resolution intervals.
Also breaks IPv6 SRV target resolution outright since the AAAA record
is leaked rather than attached to its SRV entry.
src/resolvers.c