This is an automated email from the ASF dual-hosted git repository.
moonchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 9b098746d7 dns: destruct HostEnt on free to fix SRV vector leak
(#13307)
9b098746d7 is described below
commit 9b098746d75c6c88a35c519f48b45fb901b0f348
Author: Mo Chen <[email protected]>
AuthorDate: Mon Jun 22 17:43:27 2026 -0500
dns: destruct HostEnt on free to fix SRV vector leak (#13307)
dnsBufAllocator used ClassAllocator<HostEnt, false>, so freeing a
HostEnt skipped its destructor. HostEnt embeds an SRVHosts whose
std::vector<SRV> owns heap storage, and alloc() placement-news a
fresh empty vector over the recycled block, orphaning the previous
buffer. Each recycle of a HostEnt that held SRV records leaked one
vector buffer.
Use the default Destruct_on_free=true so ~HostEnt runs on free.
---
src/iocore/dns/DNS.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/iocore/dns/DNS.cc b/src/iocore/dns/DNS.cc
index 4d107238e9..09c0e0f8cf 100644
--- a/src/iocore/dns/DNS.cc
+++ b/src/iocore/dns/DNS.cc
@@ -94,7 +94,7 @@ DNSProcessor dnsProcessor;
ClassAllocator<DNSEntry, false> dnsEntryAllocator("dnsEntryAllocator");
// Users are expected to free these entries in short order!
// We could page align this buffer to enable page flipping for recv...
-ClassAllocator<HostEnt, false> dnsBufAllocator("dnsBufAllocator", 2);
+ClassAllocator<HostEnt> dnsBufAllocator("dnsBufAllocator", 2);
//
// Function Prototypes