diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3977,16 +3977,14 @@ std::unique_ptr dbw( new CWalletDBWrapper(&bitdb, walletFile)); - CWallet *tempWallet = new CWallet(chainParams, std::move(dbw)); + std::unique_ptr tempWallet( + new CWallet(chainParams, 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..."));