diff options
| author | practicalswift <[email protected]> | 2017-08-08 17:37:11 +0200 |
|---|---|---|
| committer | practicalswift <[email protected]> | 2017-08-14 17:54:35 +0200 |
| commit | c06755f5cf0a774813d37f100655ed1974b4fcf1 (patch) | |
| tree | 52aee0ff2a7bbfd3c58564f8776844b8700267f1 /src/wallet/wallet.cpp | |
| parent | gitian: bump descriptors for master (diff) | |
| download | discoin-c06755f5cf0a774813d37f100655ed1974b4fcf1.tar.xz discoin-c06755f5cf0a774813d37f100655ed1974b4fcf1.zip | |
wallet: Fix memory leak when loading a corrupted wallet file
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 599e74149..3f1de5714 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3937,15 +3937,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...")); |