diff options
| author | Tim Ruffing <[email protected]> | 2018-05-03 17:45:51 +0200 |
|---|---|---|
| committer | Tim Ruffing <[email protected]> | 2018-05-03 19:15:11 +0200 |
| commit | 264c64380978d7b0bd3ecb56a861eb004cc58b01 (patch) | |
| tree | 03438990ead1c785bec2a2775ae424d1d3c07441 /src/wallet/db.cpp | |
| parent | Merge #13133: Remove python2 from configure.ac (diff) | |
| download | discoin-264c64380978d7b0bd3ecb56a861eb004cc58b01.tar.xz discoin-264c64380978d7b0bd3ecb56a861eb004cc58b01.zip | |
wallet: Reset BerkeleyDB handle after connection fails
According to the BerkeleyDB docs, the DbEnv handle may not be accessed
after close() has been called. This change ensures that we create a new
handle after close() is called. This avoids a segfault when the first
connection attempt fails and then a second connection attempt tries to
call open() on the already closed DbEnv handle.
Diffstat (limited to 'src/wallet/db.cpp')
| -rw-r--r-- | src/wallet/db.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index 10a06e4b9..adf694428 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -169,6 +169,7 @@ bool BerkeleyEnvironment::Open(bool retry) S_IRUSR | S_IWUSR); if (ret != 0) { dbenv->close(0); + Reset(); LogPrintf("BerkeleyEnvironment::Open: Error %d opening database environment: %s\n", ret, DbEnv::strerror(ret)); if (retry) { // try moving the database env out of the way |