You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jr...@apache.org on 2017/08/29 16:22:49 UTC

[trafficserver] 01/02: Fix coverity issues 1379739 - 1379741

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

jrushford pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 2aed3f66d284b97c33fb35c83aad7b0b1d6e1a90
Author: John J. Rushford <jr...@apache.org>
AuthorDate: Mon Aug 21 15:57:08 2017 +0000

    Fix coverity issues 1379739 - 1379741
---
 iocore/utils/Machine.cc | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/iocore/utils/Machine.cc b/iocore/utils/Machine.cc
index d6d70e4..c2c24fd 100644
--- a/iocore/utils/Machine.cc
+++ b/iocore/utils/Machine.cc
@@ -295,12 +295,10 @@ Machine::insert_id(char *id)
   char *value                                    = nullptr;
   size_t len                                     = strlen(id);
 
-  if (id != nullptr) {
-    value = static_cast<char *>(ats_malloc(len));
-    make_to_lower_case(id, lower_case_name, sizeof(lower_case_name));
-    strncpy(value, lower_case_name, strlen(lower_case_name));
-    ink_hash_table_insert(machine_id_strings, lower_case_name, value);
-  }
+  value = static_cast<char *>(ats_malloc(len + 1));
+  make_to_lower_case(id, lower_case_name, sizeof(lower_case_name));
+  strncpy(value, lower_case_name, strlen(lower_case_name));
+  ink_hash_table_insert(machine_id_strings, lower_case_name, value);
 }
 
 void

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.