From f2b49f5c49adcd2df009b86685dcdb5c1d31bec3 Mon Sep 17 00:00:00 2001 From: "Alan M. Carroll" Date: Mon, 18 Apr 2016 10:14:24 -0500 Subject: [PATCH] TS-4046: Prevent memory leak of HTTP heap for server intercept case. --- proxy/hdrs/HTTP.h | 7 ++++--- proxy/http/HttpTransact.cc | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h index b32d3ef004a..878fc83655d 100644 --- a/proxy/hdrs/HTTP.h +++ b/proxy/hdrs/HTTP.h @@ -507,7 +507,7 @@ class HTTPHdr : public MIMEHdr int valid() const; void create(HTTPType polarity, HdrHeap *heap = NULL); - void clear(); + void destroy(); void reset(); void copy(const HTTPHdr *hdr); void copy_shallow(const HTTPHdr *hdr); @@ -796,12 +796,13 @@ HTTPHdr::create(HTTPType polarity, HdrHeap *heap) } inline void -HTTPHdr::clear() +HTTPHdr::destroy() { if (m_http && m_http->m_polarity == HTTP_TYPE_REQUEST) { m_url_cached.clear(); } - this->HdrHeapSDKHandle::clear(); + // Removing the only pointers to this data therefore it needs to get cleaned up or leak. + this->HdrHeapSDKHandle::destroy(); m_http = NULL; m_mime = NULL; } diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 87763b6dab9..c3b345d820b 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -935,7 +935,7 @@ HttpTransact::EndRemapRequest(State *s) HTTP_INCREMENT_DYN_STAT(http_invalid_client_requests_stat); TRANSACT_RETURN(SM_ACTION_SEND_ERROR_CACHE_NOOP, NULL); } else { - s->hdr_info.client_response.clear(); // anything previously set is invalid from this point forward + s->hdr_info.client_response.destroy(); // anything previously set is invalid from this point forward DebugTxn("http_trans", "END HttpTransact::EndRemapRequest"); if (s->is_upgrade_request && s->post_remap_upgrade_return_point) {