aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2018-09-03 15:41:02 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2018-09-03 15:41:02 +0200
commitfa462b365715928d2c6eb52ca6a448f367084f0f (patch)
tree5b6e3171ac7cabe5015d120a870440066baa7614 /src/wallet
parent68f3c7eb080e461cfeac37f8db7034fe507241d0 (diff)
wallet: Set encrypted_batch to nullptr after delete. Avoid double free in the case of NDEBUG.
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 6cbfbc1f90..20ef80a1e5 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -687,6 +687,7 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
{
encrypted_batch->TxnAbort();
delete encrypted_batch;
+ encrypted_batch = nullptr;
// We now probably have half of our keys encrypted in memory, and half not...
// die and let the user reload the unencrypted wallet.
assert(false);
@@ -697,6 +698,7 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
if (!encrypted_batch->TxnCommit()) {
delete encrypted_batch;
+ encrypted_batch = nullptr;
// We now have keys encrypted in memory, but not on disk...
// die to avoid confusion and let the user reload the unencrypted wallet.
assert(false);