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 dbw(new CWalletDBWrapper(&bitdb, walletFile)); - CWallet *tempWallet = new CWallet(std::move(dbw)); + std::unique_ptr 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..."));