------------------------------------------------------------ revno: 13615 revision-id: squid3@treenet.co.nz-20140929071813-xfiwn4625cpx0ea8 parent: squid3@treenet.co.nz-20140929051317-f1ae6s90ez1h9ra2 committer: Amos Jeffries branch nick: trunk timestamp: Mon 2014-09-29 00:18:13 -0700 message: Cleanup: fix various uninitialized class members Also, simplify some destructors. xfree() is faster than safe_free() and both are ok in a destructor. Detected by Coverity Scan. Issue 740527, 740532, 740533, 740534, 740563, 1241964 ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20140929071813-xfiwn4625cpx0ea8 # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: ae575d9167fac429181404d049b4c773c4eb4e64 # timestamp: 2014-10-02 09:21:29 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: squid3@treenet.co.nz-20140929051317-\ # f1ae6s90ez1h9ra2 # # Begin patch === modified file 'src/StoreMetaUnpacker.cc' --- src/StoreMetaUnpacker.cc 2014-09-13 13:59:43 +0000 +++ src/StoreMetaUnpacker.cc 2014-09-29 07:18:13 +0000 @@ -61,9 +61,16 @@ memcpy(hdr_len, &buf[1], sizeof(int)); } -StoreMetaUnpacker::StoreMetaUnpacker (char const *aBuffer, ssize_t aLen, int *anInt) : buf (aBuffer), buflen(aLen), hdr_len(anInt), position(1 + sizeof(int)) +StoreMetaUnpacker::StoreMetaUnpacker(char const *aBuffer, ssize_t aLen, int *anInt) : + buf(aBuffer), + buflen(aLen), + hdr_len(anInt), + position(1 + sizeof(int)), + type('\0'), + length(0), + tail(NULL) { - assert (aBuffer != NULL); + assert(aBuffer != NULL); } void === modified file 'src/adaptation/icap/History.cc' --- src/adaptation/icap/History.cc 2014-09-13 13:59:43 +0000 +++ src/adaptation/icap/History.cc 2014-09-29 07:18:13 +0000 @@ -13,9 +13,12 @@ #include "SquidTime.h" Adaptation::Icap::History::History(): - logType(LOG_TAG_NONE), req_sz(0), - pastTime(0), concurrencyLevel(0) + logType(LOG_TAG_NONE), + req_sz(0), + pastTime(0), + concurrencyLevel(0) { + memset(¤tStart, 0, sizeof(currentStart)); } void Adaptation::Icap::History::start(const char *context) === modified file 'src/adaptation/icap/Options.cc' --- src/adaptation/icap/Options.cc 2014-09-13 13:59:43 +0000 +++ src/adaptation/icap/Options.cc 2014-09-29 07:18:13 +0000 @@ -15,10 +15,14 @@ #include "StrList.h" #include "wordlist.h" -Adaptation::Icap::Options::Options(): error("unconfigured"), - max_connections(-1), allow204(false), +Adaptation::Icap::Options::Options() : + error("unconfigured"), + max_connections(-1), + allow204(false), allow206(false), - preview(-1), theTTL(-1) + preview(-1), + theTTL(-1), + theTimestamp(0) { theTransfers.preview.name = "Transfer-Preview"; theTransfers.preview.kind = xferPreview; === modified file 'src/adaptation/icap/Xaction.cc' --- src/adaptation/icap/Xaction.cc 2014-09-13 13:59:43 +0000 +++ src/adaptation/icap/Xaction.cc 2014-09-29 07:18:13 +0000 @@ -32,8 +32,6 @@ #include "SquidConfig.h" #include "SquidTime.h" -//CBDATA_NAMESPACED_CLASS_INIT(Adaptation::Icap, Xaction); - Adaptation::Icap::Xaction::Xaction(const char *aTypeName, Adaptation::Icap::ServiceRep::Pointer &aService): AsyncJob(aTypeName), Adaptation::Initiate(aTypeName), @@ -42,13 +40,18 @@ attempts(0), connection(NULL), theService(aService), - commBuf(NULL), commBufSize(0), + commBuf(NULL), + commBufSize(0), commEof(false), reuseConnection(true), isRetriable(true), isRepeatable(true), ignoreLastWrite(false), - connector(NULL), reader(NULL), writer(NULL), closer(NULL), + stopReason(NULL), + connector(NULL), + reader(NULL), + writer(NULL), + closer(NULL), alep(new AccessLogEntry), al(*alep), cs(NULL) @@ -58,6 +61,8 @@ icapRequest = new HttpRequest; HTTPMSGLOCK(icapRequest); icap_tr_start = current_time; + memset(&icap_tio_start, 0, sizeof(icap_tio_start)); + memset(&icap_tio_finish, 0, sizeof(icap_tio_finish)); } Adaptation::Icap::Xaction::~Xaction() === modified file 'src/external_acl.cc' --- src/external_acl.cc 2014-09-28 18:42:55 +0000 +++ src/external_acl.cc 2014-09-29 07:18:13 +0000 @@ -72,7 +72,7 @@ typedef RefCount Pointer; MEMPROXY_CLASS(external_acl_format); - external_acl_format() : header(NULL), member(NULL), separator(' ') {} + external_acl_format() : type(Format::LFT_NONE), header(NULL), member(NULL), separator(' '), header_id(HDR_BAD_HDR) {} ~external_acl_format() { xfree(header); xfree(member); === modified file 'src/fs/ufs/UFSSwapDir.cc' --- src/fs/ufs/UFSSwapDir.cc 2014-09-13 13:59:43 +0000 +++ src/fs/ufs/UFSSwapDir.cc 2014-09-29 07:18:13 +0000 @@ -304,7 +304,19 @@ createSwapSubDirs(); } -Fs::Ufs::UFSSwapDir::UFSSwapDir(char const *aType, const char *anIOType) : SwapDir(aType), IO(NULL), map(new FileMap()), suggest(0), swaplog_fd (-1), currentIOOptions(new ConfigOptionVector()), ioType(xstrdup(anIOType)), cur_size(0), n_disk_objects(0) +Fs::Ufs::UFSSwapDir::UFSSwapDir(char const *aType, const char *anIOType) : + SwapDir(aType), + IO(NULL), + fsdata(NULL), + map(new FileMap()), + suggest(0), + l1(16), + l2(256), + swaplog_fd(-1), + currentIOOptions(new ConfigOptionVector()), + ioType(xstrdup(anIOType)), + cur_size(0), + n_disk_objects(0) { /* modulename is only set to disk modules that are built, by configure, * so the Find call should never return NULL here. @@ -318,7 +330,7 @@ file_close(swaplog_fd); swaplog_fd = -1; } - safe_free(ioType); + xfree(ioType); delete map; delete IO; delete currentIOOptions;