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

bcall 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 ec901e6bf6 Coverity 1497427: Uninitialized pointer field (#10497)
ec901e6bf6 is described below

commit ec901e6bf6704a6fbf77a3d4571c5e7a3c507755
Author: Bryan Call <[email protected]>
AuthorDate: Fri Sep 22 13:36:57 2023 -0700

    Coverity 1497427: Uninitialized pointer field (#10497)
---
 include/api/InkAPIInternal.h                      | 16 ++++++++--------
 iocore/cache/test/stub.cc                         |  2 --
 proxy/http/remap/unit-tests/nexthop_test_stubs.cc |  1 -
 src/api/InkAPI.cc                                 |  2 --
 4 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/include/api/InkAPIInternal.h b/include/api/InkAPIInternal.h
index 4b51e571f0..ed9452b5c4 100644
--- a/include/api/InkAPIInternal.h
+++ b/include/api/InkAPIInternal.h
@@ -353,7 +353,7 @@ public:
   enum ScopeTag { GLOBAL, SSN, TXN };
 
   /// Default Constructor
-  HttpHookState();
+  HttpHookState() = default;
 
   /// Initialize the hook state to track up to 3 sources of hooks.
   /// The argument order to this method is used to break priority ties 
(callbacks from earlier args are invoked earlier)
@@ -370,9 +370,9 @@ public:
 protected:
   /// Track the state of one scope of hooks.
   struct Scope {
-    APIHook const *_c;      ///< Current hook (candidate for invocation).
-    APIHook const *_p;      ///< Previous hook (already invoked).
-    APIHooks const *_hooks; ///< Reference to the real hook list
+    APIHook const *_c      = nullptr; ///< Current hook (candidate for 
invocation).
+    APIHook const *_p      = nullptr; ///< Previous hook (already invoked).
+    APIHooks const *_hooks = nullptr; ///< Reference to the real hook list
 
     /// Initialize the scope.
     void init(HttpAPIHooks const *scope, TSHttpHookID id);
@@ -385,10 +385,10 @@ protected:
   };
 
 private:
-  TSHttpHookID _id;
-  Scope _global; ///< Chain from global hooks.
-  Scope _ssn;    ///< Chain from session hooks.
-  Scope _txn;    ///< Chain from transaction hooks.
+  TSHttpHookID _id = TS_HTTP_LAST_HOOK; ///< Hook ID.
+  Scope _global;                        ///< Chain from global hooks.
+  Scope _ssn;                           ///< Chain from session hooks.
+  Scope _txn;                           ///< Chain from transaction hooks.
 };
 
 inline TSHttpHookID
diff --git a/iocore/cache/test/stub.cc b/iocore/cache/test/stub.cc
index 87985aa033..e4abeb1a20 100644
--- a/iocore/cache/test/stub.cc
+++ b/iocore/cache/test/stub.cc
@@ -76,8 +76,6 @@ APIHooks::clear()
 {
 }
 
-HttpHookState::HttpHookState() {}
-
 void
 HttpHookState::init(TSHttpHookID id, HttpAPIHooks const *global, HttpAPIHooks 
const *ssn, HttpAPIHooks const *txn)
 {
diff --git a/proxy/http/remap/unit-tests/nexthop_test_stubs.cc 
b/proxy/http/remap/unit-tests/nexthop_test_stubs.cc
index ad33257414..5ab1523300 100644
--- a/proxy/http/remap/unit-tests/nexthop_test_stubs.cc
+++ b/proxy/http/remap/unit-tests/nexthop_test_stubs.cc
@@ -67,7 +67,6 @@ APIHooks::clear()
 
 HttpTunnel::HttpTunnel() {}
 HttpCacheSM::HttpCacheSM() {}
-HttpHookState::HttpHookState() {}
 HttpTunnelConsumer::HttpTunnelConsumer() {}
 HttpTunnelProducer::HttpTunnelProducer() {}
 ChunkedHandler::ChunkedHandler() {}
diff --git a/src/api/InkAPI.cc b/src/api/InkAPI.cc
index 0fecc81b33..00c06835ac 100644
--- a/src/api/InkAPI.cc
+++ b/src/api/InkAPI.cc
@@ -1313,8 +1313,6 @@ APIHooks::clear()
   }
 }
 
-HttpHookState::HttpHookState() : _id(TS_HTTP_LAST_HOOK) {}
-
 void
 HttpHookState::init(TSHttpHookID id, HttpAPIHooks const *global, HttpAPIHooks 
const *ssn, HttpAPIHooks const *txn)
 {

Reply via email to