------------------------------------------------------------ revno: 13614 revision-id: squid3@treenet.co.nz-20140929051317-f1ae6s90ez1h9ra2 parent: squid3@treenet.co.nz-20140928184909-lzrrdxtan0k5a6y7 committer: Amos Jeffries branch nick: trunk timestamp: Sun 2014-09-28 22:13:17 -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 971423, 1135444, 1135445, 1231353, 1231354, 1231355, 1231356, 1234503, 1241504, 740531, 740566 ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20140929051317-f1ae6s90ez1h9ra2 # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: 35e0e0ab703584f84a2169150a3ccb8e77b7707b # timestamp: 2014-10-02 09:21:28 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: squid3@treenet.co.nz-20140928184909-\ # lzrrdxtan0k5a6y7 # # Begin patch === modified file 'src/AccessLogEntry.h' --- src/AccessLogEntry.h 2014-09-13 13:59:43 +0000 +++ src/AccessLogEntry.h 2014-09-29 05:13:17 +0000 @@ -147,8 +147,10 @@ #if USE_OPENSSL ssluser(NULL), #endif - port(NULL) { + port(NULL) + { caddr.setNoAddr(); + memset(&start_time, 0, sizeof(start_time)); } Ip::Address caddr; === modified file 'src/Notes.h' --- src/Notes.h 2014-09-13 13:59:43 +0000 +++ src/Notes.h 2014-09-29 05:13:17 +0000 @@ -81,7 +81,7 @@ typedef NotesList::const_iterator const_iterator; ///< iterates over the notes list Notes(const char *aDescr, const char **metasBlacklist, bool allowFormatted = false): descr(aDescr), blacklisted(metasBlacklist), formattedValues(allowFormatted) {} - Notes(): descr(NULL), blacklisted(NULL) {} + Notes(): descr(NULL), blacklisted(NULL), formattedValues(false) {} ~Notes() { notes.clear(); } /** * Parse a notes line and returns a pointer to the === modified file 'src/acl/Acl.h' --- src/acl/Acl.h 2014-09-13 13:59:43 +0000 +++ src/acl/Acl.h 2014-09-29 05:13:17 +0000 @@ -80,7 +80,9 @@ static ACL *FindByName(const char *name); ACL(); - explicit ACL(const ACLFlag flgs[]) : cfgline(NULL), next(NULL), flags(flgs) { memset(name, '\0', sizeof(name)); } + explicit ACL(const ACLFlag flgs[]) : cfgline(NULL), next(NULL), flags(flgs), registered(false) { + *name = 0; + } virtual ~ACL(); /// sets user-specified ACL name and squid.conf context === modified file 'src/adaptation/icap/Config.cc' --- src/adaptation/icap/Config.cc 2014-09-13 13:59:43 +0000 +++ src/adaptation/icap/Config.cc 2014-09-29 05:13:17 +0000 @@ -19,6 +19,7 @@ Adaptation::Icap::Config Adaptation::Icap::TheConfig; Adaptation::Icap::Config::Config() : + default_options_ttl(0), preview_enable(0), preview_size(0), allow206_enable(0), connect_timeout_raw(0), io_timeout_raw(0), reuse_connections(0), client_username_header(NULL), client_username_encode(0), repeat(NULL), === modified file 'src/client_side.cc' --- src/client_side.cc 2014-09-25 10:34:22 +0000 +++ src/client_side.cc 2014-09-29 05:13:17 +0000 @@ -3481,14 +3481,22 @@ ConnStateData::ConnStateData(const MasterXaction::Pointer &xact) : AsyncJob("ConnStateData"), // kids overwrite + nrequests(0), #if USE_OPENSSL sslBumpMode(Ssl::bumpEnd), +#endif + needProxyProtocolHeader_(false), +#if USE_OPENSSL switchedToHttps_(false), sslServerBump(NULL), + signAlgorithm(Ssl::algSignTrusted), #endif stoppedSending_(NULL), stoppedReceiving_(NULL) { + flags.readMore = true; // kids may overwrite + flags.swanSang = false; + pinning.host = NULL; pinning.port = -1; pinning.pinned = false; @@ -3501,8 +3509,6 @@ port = xact->squidPort; log_addr = xact->tcpClient->remote; log_addr.applyMask(Config.Addrs.client_netmask); - - flags.readMore = true; // kids may overwrite } void === modified file 'src/clients/Client.cc' --- src/clients/Client.cc 2014-09-22 19:06:19 +0000 +++ src/clients/Client.cc 2014-09-29 05:13:17 +0000 @@ -38,6 +38,10 @@ void purgeEntriesByUrl(HttpRequest * req, const char *url); Client::Client(FwdState *theFwdState): AsyncJob("Client"), + completed(false), + currentOffset(0), + responseBodyBuffer(NULL), + fwd(theFwdState), requestSender(NULL), #if USE_ADAPTATION adaptedHeadSource(NULL), @@ -48,9 +52,7 @@ theVirginReply(NULL), theFinalReply(NULL) { - fwd = theFwdState; entry = fwd->entry; - entry->lock("Client"); request = fwd->request; === modified file 'src/clients/FtpGateway.cc' --- src/clients/FtpGateway.cc 2014-09-25 13:33:18 +0000 +++ src/clients/FtpGateway.cc 2014-09-29 05:13:17 +0000 @@ -331,12 +331,28 @@ Ftp::Gateway::Gateway(FwdState *fwdState): AsyncJob("FtpStateData"), - Ftp::Client(fwdState) + Ftp::Client(fwdState), + password_url(0), + reply_hdr(NULL), + reply_hdr_state(0), + conn_att(0), + login_att(0), + mdtm(-1), + theSize(-1), + pathcomps(NULL), + filepath(NULL), + dirpath(NULL), + restart_offset(0), + proxy_host(NULL), + list_width(0), + old_filepath(NULL), + typecode('\0') { - const char *url = entry->url(); - debugs(9, 3, HERE << "'" << url << "'" ); - theSize = -1; - mdtm = -1; + debugs(9, 3, entry->url()); + + *user = 0; + *password = 0; + memset(&flags, 0, sizeof(flags)); if (Config.Ftp.passive && !flags.pasv_failed) flags.pasv_supported = 1; @@ -351,7 +367,7 @@ Ftp::Gateway::~Gateway() { - debugs(9, 3, HERE << entry->url() ); + debugs(9, 3, entry->url()); if (Comm::IsConnOpen(ctrl.conn)) { debugs(9, DBG_IMPORTANT, "Internal bug: FTP Gateway left open " << @@ -367,16 +383,11 @@ wordlistDestroy(&pathcomps); cwd_message.clean(); - - safe_free(old_filepath); - + xfree(old_filepath); title_url.clean(); - base_href.clean(); - - safe_free(filepath); - - safe_free(dirpath); + xfree(filepath); + xfree(dirpath); } /** === modified file 'src/clients/FtpRelay.cc' --- src/clients/FtpRelay.cc 2014-09-22 17:39:41 +0000 +++ src/clients/FtpRelay.cc 2014-09-29 05:13:17 +0000 @@ -137,6 +137,7 @@ Ftp::Relay::Relay(FwdState *const fwdState): AsyncJob("Ftp::Relay"), Ftp::Client(fwdState), + thePreliminaryCb(NULL), forwardingCompleted(false) { savedReply.message = NULL; === modified file 'src/helper/Request.h' --- src/helper/Request.h 2014-09-24 14:07:55 +0000 +++ src/helper/Request.h 2014-09-29 05:13:17 +0000 @@ -22,7 +22,10 @@ callback(c), data(cbdataReference(d)), placeholder(b == NULL) - {} + { + memset(&dispatch_time, 0, sizeof(dispatch_time)); + } + ~Request() { cbdataReferenceDone(data); xfree(buf); === modified file 'src/htcp.cc' --- src/htcp.cc 2014-09-13 13:59:43 +0000 +++ src/htcp.cc 2014-09-29 05:13:17 +0000 @@ -1067,7 +1067,9 @@ HtcpReplyData::HtcpReplyData() : hit(0), hdr(hoHtcpReply), msg_id(0), version(0.0) -{} +{ + memset(&cto, 0, sizeof(cto)); +} static void === modified file 'src/servers/FtpServer.cc' --- src/servers/FtpServer.cc 2014-09-28 18:35:47 +0000 +++ src/servers/FtpServer.cc 2014-09-29 05:13:17 +0000 @@ -62,6 +62,7 @@ reader() { flags.readMore = false; // we need to announce ourselves first + *uploadBuf = 0; } Ftp::Server::~Server()