aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2015-06-16 04:02:25 -0400
committerLuke Dashjr <luke-jr+git@utopios.org>2015-09-22 00:43:10 +0000
commit60457d3c2f3f38d4cc3e524a5d4030bf4034b7aa (patch)
treef78d5f3a5ff4255548f103db72d242e50da8dd6b /src
parenta496e11d7cf827d69c309faf0da9a724d98916c5 (diff)
downloadbitcoin-60457d3c2f3f38d4cc3e524a5d4030bf4034b7aa.tar.xz
locking: fix a few small issues uncovered by -Wthread-safety
- rpcwallet: No need to lock twice here - openssl: Clang doesn't understand selective lock/unlock here. Ignore it. - CNode: Fix a legitimate (though very unlikely) locking bug.
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp4
-rw-r--r--src/util.cpp2
-rw-r--r--src/wallet/rpcwallet.cpp1
3 files changed, 4 insertions, 3 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 3908be6824..2519006865 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2033,8 +2033,10 @@ void CNode::EndMessage() UNLOCK_FUNCTION(cs_vSend)
Fuzz(GetArg("-fuzzmessagestest", 10));
if (ssSend.size() == 0)
+ {
+ LEAVE_CRITICAL_SECTION(cs_vSend);
return;
-
+ }
// Set the size
unsigned int nSize = ssSend.size() - CMessageHeader::HEADER_SIZE;
WriteLE32((uint8_t*)&ssSend[CMessageHeader::MESSAGE_SIZE_OFFSET], nSize);
diff --git a/src/util.cpp b/src/util.cpp
index bfb95c9044..6f95742f83 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -113,7 +113,7 @@ CTranslationInterface translationInterface;
/** Init OpenSSL library multithreading support */
static CCriticalSection** ppmutexOpenSSL;
-void locking_callback(int mode, int i, const char* file, int line)
+void locking_callback(int mode, int i, const char* file, int line) NO_THREAD_SAFETY_ANALYSIS
{
if (mode & CRYPTO_LOCK) {
ENTER_CRITICAL_SECTION(*ppmutexOpenSSL[i]);
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 7a0e5989e0..bfaaaeb4c8 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -476,7 +476,6 @@ Value listaddressgroupings(const Array& params, bool fHelp)
addressInfo.push_back(CBitcoinAddress(address).ToString());
addressInfo.push_back(ValueFromAmount(balances[address]));
{
- LOCK(pwalletMain->cs_wallet);
if (pwalletMain->mapAddressBook.find(CBitcoinAddress(address).Get()) != pwalletMain->mapAddressBook.end())
addressInfo.push_back(pwalletMain->mapAddressBook.find(CBitcoinAddress(address).Get())->second.name);
}