trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] branch 7.1.x updated: Fix parent.config memory leak.
Date Fri, 16 Mar 2018 03:06:53 GMT
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/7.1.x by this push:
     new cd71016  Fix parent.config memory leak.
cd71016 is described below

commit cd71016ea28665b58e0ce1b0fa1c2ee84cbab644
Author: jrushford <jrushford@apache.org>
AuthorDate: Tue Mar 13 21:10:58 2018 +0000

    Fix parent.config memory leak.
    
    (cherry picked from commit 180504915d8f1f1121c8f6361896c324f7e2431d)
---
 proxy/ParentConsistentHash.cc |  1 +
 proxy/ParentSelection.cc      | 10 +++++++++-
 proxy/ParentSelection.h       |  2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/proxy/ParentConsistentHash.cc b/proxy/ParentConsistentHash.cc
index 75ccb26..87d2d6e 100644
--- a/proxy/ParentConsistentHash.cc
+++ b/proxy/ParentConsistentHash.cc
@@ -54,6 +54,7 @@ ParentConsistentHash::ParentConsistentHash(ParentRecord *parent_record)
 
 ParentConsistentHash::~ParentConsistentHash()
 {
+  Debug("parent_select", "~ParentConsistentHash(): releasing hashes");
   delete chash[PRIMARY];
   delete chash[SECONDARY];
 }
diff --git a/proxy/ParentSelection.cc b/proxy/ParentSelection.cc
index 520f754..749bc40 100644
--- a/proxy/ParentSelection.cc
+++ b/proxy/ParentSelection.cc
@@ -89,6 +89,15 @@ ParentConfigParams::ParentConfigParams(P_table *_parent_table) : parent_table(_p
   ats_free(default_val);
 }
 
+ParentConfigParams::~ParentConfigParams()
+{
+  if (parent_table) {
+    Debug("parent_select", "~ParentConfigParams(): releasing parent_table %p", parent_table);
+  }
+  delete parent_table;
+  delete DefaultParent;
+}
+
 bool
 ParentConfigParams::apiParentExists(HttpRequestData *rdata)
 {
@@ -925,7 +934,6 @@ EXCLUSIVE_REGRESSION_TEST(PARENTSELECTION)(RegressionTest * /* t ATS_UNUSED
*/,
 
 #define REBUILD                                                                         
                                  \
   do {                                                                                  
                                  \
-    delete ParentTable;                                                                 
                                  \
     delete params;                                                                      
                                  \
     ParentTable = new P_table("", "ParentSelection Unit Test Table", &http_dest_tags,
                                     \
                               ALLOW_HOST_TABLE | ALLOW_REGEX_TABLE | ALLOW_URL_TABLE | ALLOW_IP_TABLE
| DONT_BUILD_TABLE); \
diff --git a/proxy/ParentSelection.h b/proxy/ParentSelection.h
index be56fa9..8eeea51 100644
--- a/proxy/ParentSelection.h
+++ b/proxy/ParentSelection.h
@@ -325,7 +325,7 @@ class ParentConfigParams : public ConfigInfo
 {
 public:
   explicit ParentConfigParams(P_table *_parent_table);
-  ~ParentConfigParams(){};
+  ~ParentConfigParams();
 
   bool apiParentExists(HttpRequestData *rdata);
   void findParent(HttpRequestData *rdata, ParentResult *result, unsigned int fail_threshold,
unsigned int retry_time);

-- 
To stop receiving notification emails like this one, please contact
zwoop@apache.org.

Mime
View raw message