trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] branch 9.0.x updated: Fixes various crashers loading/reloading parent.config
Date Sun, 22 Dec 2019 19:57:57 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/9.0.x by this push:
     new bdcd21f  Fixes various crashers loading/reloading parent.config
bdcd21f is described below

commit bdcd21f4a9ff2c36d018ceeb5646d9aca5e1607b
Author: Randall Meyer <rrm@apache.org>
AuthorDate: Mon Nov 18 17:42:33 2019 +0800

    Fixes various crashers loading/reloading parent.config
    
    Fixes issue #5976
    
    (cherry picked from commit 9d51c2f9e68451a2450497d8c3b3fbf8ce0cbc04)
---
 src/tscore/HostLookup.cc | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/tscore/HostLookup.cc b/src/tscore/HostLookup.cc
index 37c0f9e..382ef4f 100644
--- a/src/tscore/HostLookup.cc
+++ b/src/tscore/HostLookup.cc
@@ -277,8 +277,8 @@ CharIndex::~CharIndex()
 {
   // clean up the illegal key table.
   if (illegalKey) {
-    for (auto spot = illegalKey->begin(), limit = illegalKey->end(); spot != limit;
delete &*(spot++)) {
-      ; // empty
+    for (auto &item : *illegalKey) {
+      delete item.second;
     }
   }
 }
@@ -428,9 +428,14 @@ CharIndex::iterator::advance() -> self_type &
       break;
     } else if (state.block->array[state.index].block != nullptr) {
       // There is a lower level block to iterate over, store our current state and descend
-      q[cur_level++] = state;
-      state.block    = state.block->array[state.index].block.get();
-      state.index    = 0;
+      if (static_cast<int>(q.size()) <= cur_level) {
+        q.push_back(state);
+      } else {
+        q[cur_level] = state;
+      }
+      cur_level++;
+      state.block = state.block->array[state.index].block.get();
+      state.index = 0;
     } else {
       ++state.index;
     }
@@ -556,8 +561,9 @@ HostBranch::~HostBranch()
     break;
   case HOST_HASH: {
     HostTable *ht = next_level._table;
-    for (auto spot = ht->begin(), limit = ht->end(); spot != limit; delete &*(spot++))
{
-    } // empty
+    for (auto &item : *ht) {
+      delete item.second;
+    }
     delete ht;
   } break;
   case HOST_INDEX: {


Mime
View raw message