You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2017/05/15 20:54:48 UTC

[trafficserver] 01/01: coverity 1196479: Uninitialized pointer field

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

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

commit 51fb8793347ca45f2aebad07c59b6726e56f310d
Author: Bryan Call <bc...@apache.org>
AuthorDate: Thu May 11 17:24:57 2017 -0400

    coverity 1196479: Uninitialized pointer field
---
 mgmt/LocalManager.cc | 19 ++-----------------
 mgmt/LocalManager.h  | 28 ++++++++++++++--------------
 2 files changed, 16 insertions(+), 31 deletions(-)

diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
index 2a89fac..f3da137 100644
--- a/mgmt/LocalManager.cc
+++ b/mgmt/LocalManager.cc
@@ -147,22 +147,14 @@ LocalManager::processRunning()
   }
 }
 
-LocalManager::LocalManager(bool proxy_on) : BaseManager(), run_proxy(proxy_on), configFiles(nullptr)
+LocalManager::LocalManager(bool proxy_on) : BaseManager(), run_proxy(proxy_on)
 {
   bool found;
   ats_scoped_str rundir(RecConfigReadRuntimeDir());
   ats_scoped_str bindir(RecConfigReadBinDir());
   ats_scoped_str sysconfdir(RecConfigReadConfigDir());
 
-  syslog_facility = 0;
-
-  proxy_recoverable         = true;
-  proxy_started_at          = -1;
-  proxy_launch_count        = 0;
-  manager_started_at        = time(nullptr);
-  proxy_launch_outstanding  = false;
-  mgmt_shutdown_outstanding = MGMT_PENDING_NONE;
-  proxy_running             = 0;
+  manager_started_at = time(nullptr);
 
   RecRegisterStatInt(RECT_NODE, "proxy.node.proxy_running", 0, RECP_NON_PERSISTENT);
 
@@ -212,7 +204,6 @@ LocalManager::LocalManager(bool proxy_on) : BaseManager(), run_proxy(proxy_on),
   proxy_name                   = REC_readString("proxy.config.proxy_name", &found);
   proxy_binary                 = REC_readString("proxy.config.proxy_binary", &found);
   env_prep                     = REC_readString("proxy.config.env_prep", &found);
-  proxy_options                = nullptr;
 
   // Calculate proxy_binary from the absolute bin_path
   absolute_proxy_binary = Layout::relative_to(bindir, proxy_binary);
@@ -223,12 +214,6 @@ LocalManager::LocalManager(bool proxy_on) : BaseManager(), run_proxy(proxy_on),
     mgmt_fatal(0, "[LocalManager::LocalManager] please set bin path 'proxy.config.bin_path' \n");
   }
 
-  watched_process_pid = -1;
-
-  process_server_sockfd = -1;
-  watched_process_fd    = -1;
-  proxy_launch_pid      = -1;
-
   return;
 }
 
diff --git a/mgmt/LocalManager.h b/mgmt/LocalManager.h
index d35fe0d..f45ccef 100644
--- a/mgmt/LocalManager.h
+++ b/mgmt/LocalManager.h
@@ -88,13 +88,13 @@ public:
   bool processRunning();
 
   volatile bool run_proxy;
-  volatile bool proxy_recoverable; // false if traffic_server cannot recover with a reboot
+  volatile bool proxy_recoverable = true; // false if traffic_server cannot recover with a reboot
   volatile time_t manager_started_at;
-  volatile time_t proxy_started_at;
-  volatile int proxy_launch_count;
-  volatile bool proxy_launch_outstanding;
-  volatile ManagementPendingOperation mgmt_shutdown_outstanding;
-  volatile int proxy_running;
+  volatile time_t proxy_started_at                              = -1;
+  volatile int proxy_launch_count                               = 0;
+  volatile bool proxy_launch_outstanding                        = false;
+  volatile ManagementPendingOperation mgmt_shutdown_outstanding = MGMT_PENDING_NONE;
+  volatile int proxy_running                                    = 0;
   HttpProxyPort::Group m_proxy_ports;
   // Local inbound addresses to bind, if set.
   IpAddr m_inbound_ip4;
@@ -106,19 +106,19 @@ public:
   char *absolute_proxy_binary;
   char *proxy_name;
   char *proxy_binary;
-  char *proxy_options; // These options should persist across proxy reboots
+  char *proxy_options = nullptr; // These options should persist across proxy reboots
   char *env_prep;
 
-  int process_server_sockfd;
-  volatile int watched_process_fd;
-  volatile pid_t proxy_launch_pid;
+  int process_server_sockfd       = -1;
+  volatile int watched_process_fd = -1;
+  volatile pid_t proxy_launch_pid = -1;
 
-  Alarms *alarm_keeper;
-  FileManager *configFiles;
+  Alarms *alarm_keeper     = nullptr;
+  FileManager *configFiles = nullptr;
 
-  volatile pid_t watched_process_pid;
+  volatile pid_t watched_process_pid = -1;
 
-  int syslog_facility;
+  int syslog_facility = 0;
 
 #if TS_HAS_WCCP
   wccp::Cache wccp_cache;

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