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/09/07 15:26:09 UTC

[trafficserver] branch master updated: Fixes a segfault that may occur when the debug and a lookup fails to find an entry in the hoststatus hash table.

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 05dd0fd  Fixes a segfault that may occur when the debug and a lookup fails to find an entry in the hoststatus hash table.
05dd0fd is described below

commit 05dd0fdfb223d21b9a54236ba5fb7ab2a0e04050
Author: John Rushford <jr...@apache.org>
AuthorDate: Fri Sep 7 14:43:42 2018 +0000

    Fixes a segfault that may occur when the debug and a lookup fails
    to find an entry in the hoststatus hash table.
---
 src/traffic_server/HostStatus.cc | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/traffic_server/HostStatus.cc b/src/traffic_server/HostStatus.cc
index 74240a7..f54bba1 100644
--- a/src/traffic_server/HostStatus.cc
+++ b/src/traffic_server/HostStatus.cc
@@ -166,15 +166,14 @@ HostStatus::setHostStatus(const char *name, HostStatus_t status, const unsigned
 HostStatus_t
 HostStatus::getHostStatus(const char *name)
 {
-  HostStatRec_t *_status;
-  int lookup = 0;
-  time_t now = time(0);
+  HostStatRec_t *_status = 0;
+  int lookup             = 0;
+  time_t now             = time(0);
 
   // the hash table value pointer has the HostStatus_t value.
   ink_rwlock_rdlock(&host_status_rwlock);
   lookup = ink_hash_table_lookup(hosts_statuses, name, reinterpret_cast<void **>(&_status));
   ink_rwlock_unlock(&host_status_rwlock);
-  Debug("host_statuses", "name: %s, status: %d", name, static_cast<int>(_status->status));
 
   // if the host was marked down and it's down_time has elapsed, mark it up.
   if (lookup == 1 && _status->status == HostStatus_t::HOST_STATUS_DOWN && _status->down_time > 0) {