Skip to content

Commit 5aeaa9c

Browse files
author
MarcoFalke
committed
Merge #11585: addrman: Add missing lock in Clear() (CAddrMan)
3ab545d addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
2 parents ffc0b11 + 3ab545d commit 5aeaa9c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/addrman.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ class CAddrMan
455455

456456
void Clear()
457457
{
458+
LOCK(cs);
458459
std::vector<int>().swap(vRandom);
459460
nKey = GetRandHash();
460461
for (size_t bucket = 0; bucket < ADDRMAN_NEW_BUCKET_COUNT; bucket++) {

0 commit comments

Comments
 (0)