diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 18433d1912faa..7e85382f50a10 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4280,7 +4280,6 @@ CWallet::CWallet(std::string strWalletFileIn) CWallet::~CWallet() { delete pwalletdbEncryption; - delete pStakerStatus; } void CWallet::SetNull() @@ -4300,7 +4299,7 @@ void CWallet::SetNull() if (pStakerStatus) { pStakerStatus->SetNull(); } else { - pStakerStatus = new CStakerStatus(); + pStakerStatus = MakeUnique(); } // Stake split threshold nStakeSplitThreshold = DEFAULT_STAKE_SPLIT_THRESHOLD; diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 0734d2ce8d1e3..52b790bddc5ae 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -280,7 +280,7 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface int64_t nLastResend; // Staker status (last hashed block and time) - CStakerStatus* pStakerStatus{nullptr}; + std::unique_ptr pStakerStatus; /** * Used to keep track of spent outpoints, and