diff options
| author | Wladimir J. van der Laan <[email protected]> | 2017-08-22 09:42:34 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2017-08-22 09:42:43 +0200 |
| commit | fc5c237d4a84b281104b33d5a57e9ca2289406f6 (patch) | |
| tree | 3b7a2c8d064569dffdf66661f8ee89c96dc9e931 /src/wallet/wallet.cpp | |
| parent | Merge #10843: Add attribute [[noreturn]] (C++11) to functions that will not r... (diff) | |
| parent | wallet: Fix memory leak when loading a corrupted wallet file (diff) | |
| download | discoin-fc5c237d4a84b281104b33d5a57e9ca2289406f6.tar.xz discoin-fc5c237d4a84b281104b33d5a57e9ca2289406f6.zip | |
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/wallet/wallet.cpp')
| -rw-r--r-- | src/wallet/wallet.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index c32726aeb..291bcc7a2 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...")); |