Skip to content

Commit b7d6623

Browse files
committed
Merge #10819: Fix uninitialized atomic variables
4652791 Fix uninitialized atomic variables (João Barbosa) Tree-SHA512: 5dd8924bc8743a094abdbc2464b835a0e7fd4948c102ea7c2251c6330bea5615c4459ba322a656fd6ac5f8d695b69d3709d225ddccef226cf8afc7de5e3d3019
2 parents 66270a4 + 4652791 commit b7d6623

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/netbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ static bool ConnectThroughProxy(const proxyType &proxy, const std::string& strDe
563563
// do socks negotiation
564564
if (proxy.randomize_credentials) {
565565
ProxyCredentials random_auth;
566-
static std::atomic_int counter;
566+
static std::atomic_int counter(0);
567567
random_auth.username = random_auth.password = strprintf("%i", counter++);
568568
if (!Socks5(strDest, (unsigned short)port, &random_auth, hSocket))
569569
return false;

src/wallet/db.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ class CWalletDBWrapper
9595
friend class CDB;
9696
public:
9797
/** Create dummy DB handle */
98-
CWalletDBWrapper() : nLastSeen(0), nLastFlushed(0), nLastWalletUpdate(0), env(nullptr)
98+
CWalletDBWrapper() : nUpdateCounter(0), nLastSeen(0), nLastFlushed(0), nLastWalletUpdate(0), env(nullptr)
9999
{
100100
}
101101

102102
/** Create DB handle to real database */
103103
CWalletDBWrapper(CDBEnv *env_in, const std::string &strFile_in) :
104-
nLastSeen(0), nLastFlushed(0), nLastWalletUpdate(0), env(env_in), strFile(strFile_in)
104+
nUpdateCounter(0), nLastSeen(0), nLastFlushed(0), nLastWalletUpdate(0), env(env_in), strFile(strFile_in)
105105
{
106106
}
107107

src/wallet/walletdb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ DBErrors CWalletDB::ZapWalletTx(std::vector<CWalletTx>& vWtx)
747747

748748
void MaybeCompactWalletDB()
749749
{
750-
static std::atomic<bool> fOneThread;
750+
static std::atomic<bool> fOneThread(false);
751751
if (fOneThread.exchange(true)) {
752752
return;
753753
}

0 commit comments

Comments
 (0)