Merge #9549: [net] Avoid possibility of NULL pointer dereference in MarkBlockAsInFlight(...)

95543d874 [net] Avoid possibility of NULL pointer dereference in MarkBlockAsInFlight(...) (practicalswift)

Tree-SHA512: 80fd4f2712f20377185bd8d319255f2c54ae47b54c706f7e0d384a0a6ade1465ceb6e2a4a7f7b51987a659524474a954eddf228865ebb3fc513948b5b6d7ab6d
This commit is contained in:
Pieter Wuille 2017-06-20 16:19:34 -07:00
commit b33ca14f59
No known key found for this signature in database
GPG key ID: A636E97631F767E0

View file

@ -342,7 +342,9 @@ bool MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const CBlockIndex*
// Short-circuit most stuff in case its from the same node
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash);
if (itInFlight != mapBlocksInFlight.end() && itInFlight->second.first == nodeid) {
*pit = &itInFlight->second.second;
if (pit) {
*pit = &itInFlight->second.second;
}
return false;
}