You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by cm...@apache.org on 2026/06/26 00:31:42 UTC
(trafficserver) 25/33: dns: destruct HostEnt on free to fix SRV vector leak (#13307)
This is an automated email from the ASF dual-hosted git repository.
cmcfarlen pushed a commit to branch 10.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 1020680f40ab21c68371f9adee5e0f2a0468c11d
Author: Mo Chen <mo...@apache.org>
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.
(cherry picked from commit 9b098746d75c6c88a35c519f48b45fb901b0f348)
---
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