wallet: Set encrypted_batch to nullptr after delete. Avoid double free in the case of NDEBUG.
This commit is contained in:
parent
68f3c7eb08
commit
fa462b3657
1 changed files with 2 additions and 0 deletions
|
@ -687,6 +687,7 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
|
||||||
{
|
{
|
||||||
encrypted_batch->TxnAbort();
|
encrypted_batch->TxnAbort();
|
||||||
delete encrypted_batch;
|
delete encrypted_batch;
|
||||||
|
encrypted_batch = nullptr;
|
||||||
// We now probably have half of our keys encrypted in memory, and half not...
|
// We now probably have half of our keys encrypted in memory, and half not...
|
||||||
// die and let the user reload the unencrypted wallet.
|
// die and let the user reload the unencrypted wallet.
|
||||||
assert(false);
|
assert(false);
|
||||||
|
@ -697,6 +698,7 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
|
||||||
|
|
||||||
if (!encrypted_batch->TxnCommit()) {
|
if (!encrypted_batch->TxnCommit()) {
|
||||||
delete encrypted_batch;
|
delete encrypted_batch;
|
||||||
|
encrypted_batch = nullptr;
|
||||||
// We now have keys encrypted in memory, but not on disk...
|
// We now have keys encrypted in memory, but not on disk...
|
||||||
// die to avoid confusion and let the user reload the unencrypted wallet.
|
// die to avoid confusion and let the user reload the unencrypted wallet.
|
||||||
assert(false);
|
assert(false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue