aboutsummaryrefslogtreecommitdiff
path: root/src/walletdb.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-10-08 15:49:37 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2014-10-08 15:51:32 -0700
commitdec58922d07241f0b502c96f8e5131abccbd5dc1 (patch)
tree6061a94c3cbc9b0b8948009df3ef7ee4d00e02c9 /src/walletdb.cpp
parentbf7b4fc6d3bdfd9283a633da7833a5ec6fa3cd85 (diff)
parentd0c4197ef6ecfdaff792579810107e2f1b8b319e (diff)
Merge pull request #4996
d0c4197 change exit(1) to an assert in CWallet::EncryptWallet (Philip Kaufmann) 870da77 fix possible memory leaks in CWallet::EncryptWallet (Philip Kaufmann) f606bb9 fix a possible memory leak in CWalletDB::Recover (Philip Kaufmann)
Diffstat (limited to 'src/walletdb.cpp')
-rw-r--r--src/walletdb.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/walletdb.cpp b/src/walletdb.cpp
index 3e5a664a5d..e09bb8d1b2 100644
--- a/src/walletdb.cpp
+++ b/src/walletdb.cpp
@@ -15,11 +15,11 @@
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
+#include <boost/scoped_ptr.hpp>
#include <boost/thread.hpp>
-using namespace std;
using namespace boost;
-
+using namespace std;
static uint64_t nAccountingEntryNumber = 0;
@@ -918,7 +918,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
LogPrintf("Salvage(aggressive) found %u records\n", salvagedData.size());
bool fSuccess = allOK;
- Db* pdbCopy = new Db(&dbenv.dbenv, 0);
+ boost::scoped_ptr<Db> pdbCopy(new Db(&dbenv.dbenv, 0));
int ret = pdbCopy->open(NULL, // Txn pointer
filename.c_str(), // Filename
"main", // Logical db name
@@ -959,7 +959,6 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
}
ptxn->commit(0);
pdbCopy->close(0);
- delete pdbCopy;
return fSuccess;
}