Skip to content

Commit

Permalink
wallet: Add missing cs_db lock
Browse files Browse the repository at this point in the history
Without this lock BerkeleyEnvironment::~BerkeleyEnvironment and
GetWalletEnv would race for g_dbenvs. This wasn't detected before
because thread safety analysis does not check constructors and
destructors.
  • Loading branch information
promag committed Feb 1, 2019
1 parent efb6dde commit 712d35b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/wallet/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ BerkeleyEnvironment::BerkeleyEnvironment(const fs::path& dir_path) : strPath(dir

BerkeleyEnvironment::~BerkeleyEnvironment()
{
LOCK(cs_db);
g_dbenvs.erase(strPath);
Close();
}
Expand Down

0 comments on commit 712d35b

Please sign in to comment.