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:
commit
b33ca14f59
1 changed files with 3 additions and 1 deletions
|
@ -342,7 +342,9 @@ bool MarkBlockAsInFlight(NodeId nodeid, const uint256& hash, const CBlockIndex*
|
||||||
// Short-circuit most stuff in case its from the same node
|
// 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);
|
std::map<uint256, std::pair<NodeId, std::list<QueuedBlock>::iterator> >::iterator itInFlight = mapBlocksInFlight.find(hash);
|
||||||
if (itInFlight != mapBlocksInFlight.end() && itInFlight->second.first == nodeid) {
|
if (itInFlight != mapBlocksInFlight.end() && itInFlight->second.first == nodeid) {
|
||||||
*pit = &itInFlight->second.second;
|
if (pit) {
|
||||||
|
*pit = &itInFlight->second.second;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue