aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/bdb.cpp
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2023-05-15 15:50:35 -0400
committerAndrew Chow <github@achow101.com>2023-05-31 15:17:05 -0400
commit84b2f353bbefb9264284e7430863b2fa1d796d38 (patch)
tree31fb3a1fec636bbe336710961261e3b31e2623e2 /src/wallet/bdb.cpp
parent71300489af362c3fed4736de6bffab4d758b6a84 (diff)
downloadbitcoin-84b2f353bbefb9264284e7430863b2fa1d796d38.tar.xz
walletdb: Consistently clear key and value streams before writing
Before writing data to the output key and value streams, make sure they are cleared.
Diffstat (limited to 'src/wallet/bdb.cpp')
-rw-r--r--src/wallet/bdb.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/wallet/bdb.cpp b/src/wallet/bdb.cpp
index 6dce51fc12..dbd80718f6 100644
--- a/src/wallet/bdb.cpp
+++ b/src/wallet/bdb.cpp
@@ -777,6 +777,7 @@ bool BerkeleyBatch::ReadKey(DataStream&& key, DataStream& value)
SafeDbt datValue;
int ret = pdb->get(activeTxn, datKey, datValue, 0);
if (ret == 0 && datValue.get_data() != nullptr) {
+ value.clear();
value.write({AsBytePtr(datValue.get_data()), datValue.get_size()});
return true;
}