aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-09-10 17:58:40 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-09-10 17:59:15 +0200
commit6eeac2e628b5332dcaee60e5c83861c94e44d04d (patch)
tree5bd2b30cae2c0d4c2d3e4513cda547c3124e16a3 /src
parent321075609d23a1e23b7b905294516a497c14d07d (diff)
parentfa462b365715928d2c6eb52ca6a448f367084f0f (diff)
downloadbitcoin-6eeac2e628b5332dcaee60e5c83861c94e44d04d.tar.xz
Merge #14138: wallet: Set encrypted_batch to nullptr after delete. Avoid double free in the case of NDEBUG.
fa462b365715928d2c6eb52ca6a448f367084f0f wallet: Set encrypted_batch to nullptr after delete. Avoid double free in the case of NDEBUG. (practicalswift) Pull request description: Set `encrypted_batch` to `nullptr` after delete. Avoid double free in the case of `NDEBUG`. Tree-SHA512: 6f5ab40c82dd8c8713bbf1aacacdc837277c04769807f985248546be1c7ea269813c95379fbef982ac5683a45af0225613460a7446c39673b033f5f5edde2f5a
Diffstat (limited to 'src')
-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 e41f829f02..de707a09f4 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);