aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-08-22 09:42:34 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-08-22 09:42:43 +0200
commitfc5c237d4a84b281104b33d5a57e9ca2289406f6 (patch)
tree3b7a2c8d064569dffdf66661f8ee89c96dc9e931 /src
parent2ab7c6300f87a1c7f5a5805f7677e07ab809cac7 (diff)
parentc06755f5cf0a774813d37f100655ed1974b4fcf1 (diff)
Merge #11007: wallet: Fix potential memory leak when loading a corrupted wallet file
c06755f wallet: Fix memory leak when loading a corrupted wallet file (practicalswift) Pull request description: Fix potential memory leak when loading a corrupted wallet file. Tree-SHA512: 4b836e4ee1fe4267213bb126af0c1174f964ff015fbe28d0a7e679eab877c275769906b3c08f885763958f6a9b559e1b5e6c7bff1df340bf2dfa2acd57500818
Diffstat (limited to 'src')
-rw-r--r--src/wallet/wallet.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index c32726aeb0..291bcc7a20 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -3934,15 +3934,12 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile)
uiInterface.InitMessage(_("Zapping all transactions from wallet..."));
std::unique_ptr<CWalletDBWrapper> dbw(new CWalletDBWrapper(&bitdb, walletFile));
- CWallet *tempWallet = new CWallet(std::move(dbw));
+ std::unique_ptr<CWallet> tempWallet(new CWallet(std::move(dbw)));
DBErrors nZapWalletRet = tempWallet->ZapWalletTx(vWtx);
if (nZapWalletRet != DB_LOAD_OK) {
InitError(strprintf(_("Error loading %s: Wallet corrupted"), walletFile));
return nullptr;
}
-
- delete tempWallet;
- tempWallet = nullptr;
}
uiInterface.InitMessage(_("Loading wallet..."));