This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 8.0.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/8.0.x by this push: new 39a1191 Revert "Fixes memory leaks in header_rewrite" 39a1191 is described below commit 39a11910820252a75147ae135a31c118198d3926 Author: Leif Hedstrom <l...@ogre.com> AuthorDate: Thu Nov 1 11:00:41 2018 -0600 Revert "Fixes memory leaks in header_rewrite" This reverts commit 14cc19087971341de0b6e130c6cf8a072bc93970. --- plugins/header_rewrite/condition.h | 6 ------ plugins/header_rewrite/header_rewrite.cc | 4 +--- plugins/header_rewrite/ruleset.cc | 2 -- plugins/header_rewrite/ruleset.h | 13 +------------ plugins/header_rewrite/statement.h | 1 - plugins/header_rewrite/value.h | 6 ------ 6 files changed, 2 insertions(+), 30 deletions(-) diff --git a/plugins/header_rewrite/condition.h b/plugins/header_rewrite/condition.h index 73e3297..ebafab4 100644 --- a/plugins/header_rewrite/condition.h +++ b/plugins/header_rewrite/condition.h @@ -52,12 +52,6 @@ public: TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for Condition"); } - virtual ~Condition() - { - TSDebug(PLUGIN_NAME_DBG, "Calling DTOR for Condition"); - delete _matcher; - } - // Inline this, it's critical for speed (and only used twice) bool do_eval(const Resources &res) diff --git a/plugins/header_rewrite/header_rewrite.cc b/plugins/header_rewrite/header_rewrite.cc index e95b53c..b4aaacd 100644 --- a/plugins/header_rewrite/header_rewrite.cc +++ b/plugins/header_rewrite/header_rewrite.cc @@ -72,7 +72,6 @@ class RulesConfig public: RulesConfig() { - TSDebug(PLUGIN_NAME_DBG, "RulesConfig CTOR"); memset(_rules, 0, sizeof(_rules)); memset(_resids, 0, sizeof(_resids)); @@ -82,8 +81,7 @@ public: ~RulesConfig() { - TSDebug(PLUGIN_NAME_DBG, "RulesConfig DTOR"); - for (int i = TS_HTTP_READ_REQUEST_HDR_HOOK; i <= TS_HTTP_LAST_HOOK; ++i) { + for (int i = TS_HTTP_READ_REQUEST_HDR_HOOK; i < TS_HTTP_LAST_HOOK; ++i) { delete _rules[i]; } TSContDestroy(_cont); diff --git a/plugins/header_rewrite/ruleset.cc b/plugins/header_rewrite/ruleset.cc index f6d0140..9dfe89c 100644 --- a/plugins/header_rewrite/ruleset.cc +++ b/plugins/header_rewrite/ruleset.cc @@ -49,7 +49,6 @@ RuleSet::add_condition(Parser &p, const char *filename, int lineno) TSDebug(PLUGIN_NAME, " Adding condition: %%{%s} with arg: %s", p.get_op().c_str(), p.get_arg().c_str()); c->initialize(p); if (!c->set_hook(_hook)) { - delete c; TSError("[%s] in %s:%d: can't use this condition in hook=%s: %%{%s} with arg: %s", PLUGIN_NAME, filename, lineno, TSHttpHookNameLookup(_hook), p.get_op().c_str(), p.get_arg().c_str()); return false; @@ -80,7 +79,6 @@ RuleSet::add_operator(Parser &p, const char *filename, int lineno) TSDebug(PLUGIN_NAME, " Adding operator: %s(%s)", p.get_op().c_str(), p.get_arg().c_str()); o->initialize(p); if (!o->set_hook(_hook)) { - delete o; TSDebug(PLUGIN_NAME, "in %s:%d: can't use this operator in hook=%s: %s(%s)", filename, lineno, TSHttpHookNameLookup(_hook), p.get_op().c_str(), p.get_arg().c_str()); TSError("[%s] in %s:%d: can't use this operator in hook=%s: %s(%s)", PLUGIN_NAME, filename, lineno, diff --git a/plugins/header_rewrite/ruleset.h b/plugins/header_rewrite/ruleset.h index fcf74af..95b80d0 100644 --- a/plugins/header_rewrite/ruleset.h +++ b/plugins/header_rewrite/ruleset.h @@ -42,18 +42,7 @@ public: _hook(TS_HTTP_READ_RESPONSE_HDR_HOOK), _ids(RSRC_NONE), _opermods(OPER_NONE), - _last(false) - { - TSDebug(PLUGIN_NAME_DBG, "RuleSet CTOR"); - } - - ~RuleSet() - { - TSDebug(PLUGIN_NAME_DBG, "RulesSet DTOR"); - delete next; - delete _cond; - delete _oper; - } + _last(false){}; // No reason to inline these void append(RuleSet *rule); diff --git a/plugins/header_rewrite/statement.h b/plugins/header_rewrite/statement.h index 153ac93..83ce00f 100644 --- a/plugins/header_rewrite/statement.h +++ b/plugins/header_rewrite/statement.h @@ -105,7 +105,6 @@ public: { TSDebug(PLUGIN_NAME_DBG, "Calling DTOR for Statement"); free_pdata(); - delete _next; } // Private data diff --git a/plugins/header_rewrite/value.h b/plugins/header_rewrite/value.h index 3f70bee..11706bc 100644 --- a/plugins/header_rewrite/value.h +++ b/plugins/header_rewrite/value.h @@ -45,12 +45,6 @@ public: TSDebug(PLUGIN_NAME_DBG, "Calling CTOR for Value"); } - virtual ~Value() - { - TSDebug(PLUGIN_NAME_DBG, "Calling DTOR for Value"); - delete _cond_val; - } - void set_value(const std::string &val) {