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

rrm 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 f36b670  Fixes memory leaks in compress plugin
f36b670 is described below

commit f36b6707eed65619f0a067d8ec5c3bf9020f7c58
Author: Randall Meyer <r...@apple.com>
AuthorDate: Tue Oct 23 08:53:20 2018 -0700

    Fixes memory leaks in compress plugin
    
    Prior to this, the plugin would leak every reload
---
 plugins/compress/compress.cc | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/plugins/compress/compress.cc b/plugins/compress/compress.cc
index 6eb9b72..a14277f 100644
--- a/plugins/compress/compress.cc
+++ b/plugins/compress/compress.cc
@@ -52,7 +52,6 @@ using namespace Gzip;
 // to be about the best level to use in an HTTP Server.
 
 const int ZLIB_COMPRESSION_LEVEL = 6;
-const char *global_hidden_header_name;
 const char *dictionary           = nullptr;
 const char *TS_HTTP_VALUE_BROTLI = "br";
 const int TS_HTTP_LEN_BROTLI     = 2;
@@ -63,6 +62,8 @@ const int BROTLI_COMPRESSION_LEVEL = 6;
 const int BROTLI_LGW               = 16;
 #endif
 
+static const char *global_hidden_header_name = nullptr;
+
 // Current global configuration, and the previous one (for cleanup)
 Configuration *cur_config  = nullptr;
 Configuration *prev_config = nullptr;
@@ -972,7 +973,7 @@ load_global_configuration(TSCont contp)
 
   debug("config swapped, old config %p", oldconfig);
 
-  // First, if there was a previous configuration, clean that one out. This 
avois the
+  // First, if there was a previous configuration, clean that one out. This 
avoids the
   // small race condition tht exist between doing a find() and calling hold() 
on a
   // HostConfig object.
   if (prev_config) {
@@ -1078,7 +1079,9 @@ void
 TSRemapDeleteInstance(void *instance)
 {
   debug("Cleanup configs read from remap");
-  static_cast<Configuration *>(instance)->release_all();
+  auto c = static_cast<Configuration *>(instance);
+  c->release_all();
+  delete c;
 }
 
 TSRemapStatus

Reply via email to