mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 18:53:23 -03:00
Merge #14138: wallet: Set encrypted_batch to nullptr after delete. Avoid double free in the case of NDEBUG.
fa462b3657
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
This commit is contained in:
commit
6eeac2e628
1 changed files with 2 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue