------------------------------------------------------------ revno: 13728 revision-id: squid3@treenet.co.nz-20150118042607-fp791x4slihy8w1w parent: squid3@treenet.co.nz-20150118042451-bdsb3imuettire14 committer: Amos Jeffries branch nick: 3.5 timestamp: Sat 2015-01-17 20:26:07 -0800 message: Fix several crashes when debugging enabled psstate->entry may be null, it is not safe to directly access the entry url() method. Use the safe alternative offered by psstate instead. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20150118042607-fp791x4slihy8w1w # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: 97b3880aa8108182497cb780ea1c7e50b77fe050 # timestamp: 2015-01-18 04:27:37 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squid3@treenet.co.nz-20150118042451-\ # bdsb3imuettire14 # # Begin patch === modified file 'src/peer_select.cc' --- src/peer_select.cc 2015-01-13 09:13:49 +0000 +++ src/peer_select.cc 2015-01-18 04:26:07 +0000 @@ -107,7 +107,7 @@ assert(entry); assert(entry->ping_status == PING_NONE); assert(direct != DIRECT_YES); - debugs(44, 3, "peerSelectIcpPing: " << entry->url() ); + debugs(44, 3, "peerSelectIcpPing: " << entry->url()); if (!request->flags.hierarchical && direct != DIRECT_NO) return 0; @@ -255,7 +255,7 @@ if (fs && psstate->paths->size() < (unsigned int)Config.forward_max_tries) { // send the next one off for DNS lookup. const char *host = fs->_peer ? fs->_peer->host : psstate->request->GetHost(); - debugs(44, 2, "Find IP destination for: " << psstate->entry->url() << "' via " << host); + debugs(44, 2, "Find IP destination for: " << psstate->url() << "' via " << host); ipcache_nbgethostbyname(host, peerSelectDnsResults, psstate); return; } @@ -753,7 +753,7 @@ StoreEntry *entry = psstate->entry; if (entry) - debugs(44, 3, "peerPingTimeout: '" << entry->url() << "'" ); + debugs(44, 3, "peerPingTimeout: '" << psstate->url() << "'" ); if (!cbdataReferenceValid(psstate->callback_data)) { /* request aborted */ @@ -821,7 +821,7 @@ { ps_state *psstate = (ps_state *)data; icp_opcode op = header->getOpCode(); - debugs(44, 3, "peerHandleIcpReply: " << icp_opcode_str[op] << " " << psstate->entry->url() ); + debugs(44, 3, "peerHandleIcpReply: " << icp_opcode_str[op] << " " << psstate->url() ); #if USE_CACHE_DIGESTS && 0 /* do cd lookup to count false misses */ @@ -854,9 +854,7 @@ peerHandleHtcpReply(CachePeer * p, peer_t type, HtcpReplyData * htcp, void *data) { ps_state *psstate = (ps_state *)data; - debugs(44, 3, "peerHandleHtcpReply: " << - (htcp->hit ? "HIT" : "MISS") << " " << - psstate->entry->url() ); + debugs(44, 3, "" << (htcp->hit ? "HIT" : "MISS") << " " << psstate->url()); ++ psstate->ping.n_recv; if (htcp->hit) {