]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Address several Coverity issues dealing with noninitialized data members
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 2 Jan 2013 10:12:45 +0000 (03:12 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 2 Jan 2013 10:12:45 +0000 (03:12 -0700)
Complete and fix some class constructors, removed redundant htcpReplyData

src/htcp.cc
src/htcp.h
src/icp_v2.cc
src/ip/QosConfig.cc
src/ipc/Kid.cc
src/neighbors.cc
src/peer_select.cc
src/ssl/helper.cc

index 2c33a680c63538f3c9248d1feb4bfb1b77c7498a..49cc72a2c6ac515eca26881d9ce8336e31acbc7a 100644 (file)
@@ -1088,14 +1088,15 @@ htcpHandleTst(htcpDataHeader * hdr, char *buf, int sz, Ip::Address &from)
         htcpHandleTstResponse(hdr, buf, sz, from);
 }
 
-HtcpReplyData::HtcpReplyData() : hdr(hoHtcpReply)
+HtcpReplyData::HtcpReplyData() :
+        hit(0), hdr(hoHtcpReply), msg_id(0), version(0.0)
 {}
 
 static void
 
 htcpHandleTstResponse(htcpDataHeader * hdr, char *buf, int sz, Ip::Address &from)
 {
-    htcpReplyData htcpReply;
+    HtcpReplyData htcpReply;
     cache_key *key = NULL;
 
     Ip::Address *peer;
index 631d1c0f5e058d1b9ff6c6a77b851677c4f38bc4..cb33473362aad040d4746860e7bc58eaf4b8918c 100644 (file)
@@ -57,11 +57,8 @@ public:
     } cto;
 };
 
-/// \bug redundant typedef
-typedef class HtcpReplyData htcpReplyData;
-
 /// \ingroup ServerProtocolHTCP
-void neighborsHtcpReply(const cache_key *, htcpReplyData *, const Ip::Address &);
+void neighborsHtcpReply(const cache_key *, HtcpReplyData *, const Ip::Address &);
 
 /// \ingroup ServerProtocolHTCP
 void htcpOpenPorts(void);
index 6b253bcd5f01e0a39c3e86e332646b8f7b34b538..f0a1e5f456b07ede3e8ad1da40d08eadd74738d7 100644 (file)
@@ -95,10 +95,13 @@ Comm::ConnectionPointer icpIncomingConn = NULL;
 Comm::ConnectionPointer icpOutgoingConn = NULL;
 
 /* icp_common_t */
-_icp_common_t::_icp_common_t() : opcode(ICP_INVALID), version(0), length(0), reqnum(0), flags(0), pad(0), shostid(0)
+_icp_common_t::_icp_common_t() :
+        opcode(ICP_INVALID), version(0), length(0), reqnum(0),
+        flags(0), pad(0), shostid(0)
 {}
 
-_icp_common_t::_icp_common_t(char *buf, unsigned int len)
+_icp_common_t::_icp_common_t(char *buf, unsigned int len) :
+        opcode(ICP_INVALID), version(0), reqnum(0), flags(0), pad(0), shostid(0)
 {
     if (len < sizeof(_icp_common_t)) {
         /* mark as invalid */
index 268584c7620c0f834613e6124a2294f76e3917f9..8fd23c8af6fdce909fa59f84aef3e85685fb9d59 100644 (file)
@@ -184,22 +184,14 @@ Ip::Qos::doNfmarkLocalHit(const Comm::ConnectionPointer &conn)
 
 Ip::Qos::Config Ip::Qos::TheConfig;
 
-Ip::Qos::Config::Config()
+Ip::Qos::Config::Config() : tosLocalHit(0), tosSiblingHit(0), tosParentHit(0),
+        tosMiss(0), tosMissMask(0), preserveMissTos(false),
+        preserveMissTosMask(0xFF), markLocalHit(0), markSiblingHit(0),
+        markParentHit(0), markMiss(0), markMissMask(0),
+        preserveMissMark(false), preserveMissMarkMask(0xFFFFFFFF),
+        tosToServer(NULL), tosToClient(NULL), nfmarkToServer(NULL),
+        nfmarkToClient(NULL)
 {
-    tosLocalHit = 0;
-    tosSiblingHit = 0;
-    tosParentHit = 0;
-    tosMiss = 0;
-    tosMissMask = 0;
-    preserveMissTos = false;
-    preserveMissTosMask = 0xFF;
-    markLocalHit = 0;
-    markSiblingHit = 0;
-    markParentHit = 0;
-    markMiss = 0;
-    markMissMask = 0;
-    preserveMissMark = false;
-    preserveMissMarkMask = 0xFFFFFFFF;
 }
 
 void
index 9ba836d05e538bcc6638233db77277b4aab867ba..ee54cfb114060537ed95e411f44c37e03360e13e 100644 (file)
@@ -17,7 +17,8 @@ Kid::Kid():
         badFailures(0),
         pid(-1),
         startTime(0),
-        isRunning(false)
+        isRunning(false),
+        status(0)
 {
 }
 
@@ -26,7 +27,8 @@ Kid::Kid(const String& kid_name):
         badFailures(0),
         pid(-1),
         startTime(0),
-        isRunning(false)
+        isRunning(false),
+        status(0)
 {
 }
 
index 43aa5177200a32144d7cdd34d50ffbf10d276072..fb937819c0dc1d93259448f106963f3a4166ec8f 100644 (file)
@@ -74,7 +74,7 @@ static int peerWouldBePinged(const CachePeer *, HttpRequest *);
 static void neighborRemove(CachePeer *);
 static void neighborAlive(CachePeer *, const MemObject *, const icp_common_t *);
 #if USE_HTCP
-static void neighborAliveHtcp(CachePeer *, const MemObject *, const htcpReplyData *);
+static void neighborAliveHtcp(CachePeer *, const MemObject *, const HtcpReplyData *);
 #endif
 static void neighborCountIgnored(CachePeer *);
 static void peerRefreshDNS(void *);
@@ -893,7 +893,7 @@ neighborUpdateRtt(CachePeer * p, MemObject * mem)
 
 #if USE_HTCP
 static void
-neighborAliveHtcp(CachePeer * p, const MemObject * mem, const htcpReplyData * htcp)
+neighborAliveHtcp(CachePeer * p, const MemObject * mem, const HtcpReplyData * htcp)
 {
     peerAlive(p);
     ++ p->stats.pings_acked;
@@ -1689,7 +1689,7 @@ dump_peers(StoreEntry * sentry, CachePeer * peers)
 
 #if USE_HTCP
 void
-neighborsHtcpReply(const cache_key * key, htcpReplyData * htcp, const Ip::Address &from)
+neighborsHtcpReply(const cache_key * key, HtcpReplyData * htcp, const Ip::Address &from)
 {
     StoreEntry *e = Store::Root().get(key);
     MemObject *mem = NULL;
index 8b1c8e9254736ed8c33e4546d7e4bddb8d39121c..b707a07ff97daf34cd49589eda7f0d97f2477201 100644 (file)
@@ -72,8 +72,8 @@ static IRCB peerHandlePingReply;
 static void peerSelectStateFree(ps_state * psstate);
 static void peerIcpParentMiss(CachePeer *, icp_common_t *, ps_state *);
 #if USE_HTCP
-static void peerHtcpParentMiss(CachePeer *, htcpReplyData *, ps_state *);
-static void peerHandleHtcpReply(CachePeer *, peer_t, htcpReplyData *, void *);
+static void peerHtcpParentMiss(CachePeer *, HtcpReplyData *, ps_state *);
+static void peerHandleHtcpReply(CachePeer *, peer_t, HtcpReplyData *, void *);
 #endif
 static int peerCheckNetdbDirect(ps_state * psstate);
 static void peerGetSomeNeighbor(ps_state *);
@@ -836,7 +836,7 @@ peerHandleIcpReply(CachePeer * p, peer_t type, icp_common_t * header, void *data
 
 #if USE_HTCP
 static void
-peerHandleHtcpReply(CachePeer * p, peer_t type, htcpReplyData * htcp, void *data)
+peerHandleHtcpReply(CachePeer * p, peer_t type, HtcpReplyData * htcp, void *data)
 {
     ps_state *psstate = (ps_state *)data;
     debugs(44, 3, "peerHandleHtcpReply: " <<
@@ -861,7 +861,7 @@ peerHandleHtcpReply(CachePeer * p, peer_t type, htcpReplyData * htcp, void *data
 }
 
 static void
-peerHtcpParentMiss(CachePeer * p, htcpReplyData * htcp, ps_state * ps)
+peerHtcpParentMiss(CachePeer * p, HtcpReplyData * htcp, ps_state * ps)
 {
     int rtt;
 
@@ -910,7 +910,7 @@ peerHandlePingReply(CachePeer * p, peer_t type, AnyP::ProtocolType proto, void *
 #if USE_HTCP
 
     else if (proto == AnyP::PROTO_HTCP)
-        peerHandleHtcpReply(p, type, (htcpReplyData *)pingdata, data);
+        peerHandleHtcpReply(p, type, (HtcpReplyData *)pingdata, data);
 
 #endif
 
index 6c8803b99fa9726230a1ab3d30475748f2d92a2d..f5f522b80d5d5f738be60b5429eda8dbe5239841 100644 (file)
@@ -14,7 +14,7 @@ Ssl::Helper * Ssl::Helper::GetInstance()
     return &sslHelper;
 }
 
-Ssl::Helper::Helper()
+Ssl::Helper::Helper() : ssl_crtd(NULL)
 {
 }