You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by vm...@apache.org on 2018/03/15 21:33:27 UTC

[trafficserver] branch master updated: Fix parent.config memory leak.

This is an automated email from the ASF dual-hosted git repository.

vmamidi 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 1805049  Fix parent.config memory leak.
1805049 is described below

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

    Fix parent.config memory leak.
---
 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 5c95da0..f8185ed 100644
--- a/proxy/ParentConsistentHash.cc
+++ b/proxy/ParentConsistentHash.cc
@@ -55,6 +55,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 79d541b..4027e36 100644
--- a/proxy/ParentSelection.cc
+++ b/proxy/ParentSelection.cc
@@ -91,6 +91,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)
 {
@@ -956,7 +965,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 b1d3144..d718e53 100644
--- a/proxy/ParentSelection.h
+++ b/proxy/ParentSelection.h
@@ -302,7 +302,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
vmamidi@apache.org.