mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-24 18:23:26 -03:00
wallet: Fix use-after-free in WalletBatch::EraseRecords
Github-Pull: bitcoin/bitcoin#29176
Rebased-From: faebf1df2a
This commit is contained in:
parent
6acfc4324c
commit
cf0f43ee42
1 changed files with 2 additions and 2 deletions
|
@ -1132,13 +1132,13 @@ bool WalletBatch::EraseRecords(const std::unordered_set<std::string>& types)
|
|||
}
|
||||
|
||||
// Make a copy of key to avoid data being deleted by the following read of the type
|
||||
Span key_data{key};
|
||||
const SerializeData key_data{key.begin(), key.end()};
|
||||
|
||||
std::string type;
|
||||
key >> type;
|
||||
|
||||
if (types.count(type) > 0) {
|
||||
m_batch->Erase(key_data);
|
||||
m_batch->Erase(Span{key_data});
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue