------------------------------------------------------------ revno: 12446 revision-id: squid3@treenet.co.nz-20130102101245-m34bpngdr09sql62 parent: squid3@treenet.co.nz-20130102101130-9chx2c4i546mz9hy author: Francesco Chemolli committer: Amos Jeffries branch nick: 3.3 timestamp: Wed 2013-01-02 03:12:45 -0700 message: Address several Coverity issues dealing with noninitialized data members Complete and fix some class constructors, removed redundant htcpReplyData ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20130102101245-m34bpngdr09sql62 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: b743269020bf4ee5501c30e627bb3edc91e2f67a # timestamp: 2013-01-02 10:14:56 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20130102101130-\ # 9chx2c4i546mz9hy # # Begin patch === modified file 'src/htcp.cc' --- src/htcp.cc 2013-01-02 10:04:32 +0000 +++ src/htcp.cc 2013-01-02 10:12:45 +0000 @@ -1088,14 +1088,15 @@ 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; === modified file 'src/htcp.h' --- src/htcp.h 2012-09-20 11:28:21 +0000 +++ src/htcp.h 2013-01-02 10:12:45 +0000 @@ -57,11 +57,8 @@ } 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); === modified file 'src/icp_v2.cc' --- src/icp_v2.cc 2012-09-04 09:10:20 +0000 +++ src/icp_v2.cc 2013-01-02 10:12:45 +0000 @@ -95,10 +95,13 @@ 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 */ === modified file 'src/ip/QosConfig.cc' --- src/ip/QosConfig.cc 2012-08-31 16:57:39 +0000 +++ src/ip/QosConfig.cc 2013-01-02 10:12:45 +0000 @@ -184,22 +184,14 @@ 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 === modified file 'src/ipc/Kid.cc' --- src/ipc/Kid.cc 2012-09-01 14:38:36 +0000 +++ src/ipc/Kid.cc 2013-01-02 10:12:45 +0000 @@ -17,7 +17,8 @@ badFailures(0), pid(-1), startTime(0), - isRunning(false) + isRunning(false), + status(0) { } @@ -26,7 +27,8 @@ badFailures(0), pid(-1), startTime(0), - isRunning(false) + isRunning(false), + status(0) { } === modified file 'src/neighbors.cc' --- src/neighbors.cc 2012-11-29 10:26:58 +0000 +++ src/neighbors.cc 2013-01-02 10:12:45 +0000 @@ -74,7 +74,7 @@ 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 @@ #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 @@ #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; === modified file 'src/peer_select.cc' --- src/peer_select.cc 2012-09-19 17:16:56 +0000 +++ src/peer_select.cc 2013-01-02 10:12:45 +0000 @@ -72,8 +72,8 @@ 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 @@ #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 @@ } static void -peerHtcpParentMiss(CachePeer * p, htcpReplyData * htcp, ps_state * ps) +peerHtcpParentMiss(CachePeer * p, HtcpReplyData * htcp, ps_state * ps) { int rtt; @@ -910,7 +910,7 @@ #if USE_HTCP else if (proto == AnyP::PROTO_HTCP) - peerHandleHtcpReply(p, type, (htcpReplyData *)pingdata, data); + peerHandleHtcpReply(p, type, (HtcpReplyData *)pingdata, data); #endif === modified file 'src/ssl/helper.cc' --- src/ssl/helper.cc 2012-09-04 09:10:20 +0000 +++ src/ssl/helper.cc 2013-01-02 10:12:45 +0000 @@ -14,7 +14,7 @@ return &sslHelper; } -Ssl::Helper::Helper() +Ssl::Helper::Helper() : ssl_crtd(NULL) { }