aboutsummaryrefslogtreecommitdiff
path: root/src/bench/coin_selection.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-02-23 17:16:45 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2018-02-23 17:17:07 +0100
commitacd1e6155ca62a6d91ca8d5eb23ea64f94d098b5 (patch)
tree6e2e5174c510ecbe8741fb22c59e5f6b26e21e56 /src/bench/coin_selection.cpp
parent28b8061d9f1c0a44bf3dff4d47f01187e861b1b0 (diff)
parentfadb39ca6237781346ca3da319e2bd9e48a5a604 (diff)
downloadbitcoin-acd1e6155ca62a6d91ca8d5eb23ea64f94d098b5.tar.xz
Merge #12477: test: Plug memory leaks and stack-use-after-scope
fadb39c test: Plug memory leaks and stack-use-after-scope (MarcoFalke) Pull request description: Tree-SHA512: 7bd6bbba43c7870bbd9732d73ecfc520f21701168e6fb4ad099a08ea5b21d9cd09215e70d22fb92a1af03993204ef89ad74b3e80d9fa5a10831c3e7cf2dd04cd
Diffstat (limited to 'src/bench/coin_selection.cpp')
-rw-r--r--src/bench/coin_selection.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp
index 06d2abeac6..6f438b60e9 100644
--- a/src/bench/coin_selection.cpp
+++ b/src/bench/coin_selection.cpp
@@ -37,11 +37,6 @@ static void CoinSelection(benchmark::State& state)
LOCK(wallet.cs_wallet);
while (state.KeepRunning()) {
- // Empty wallet.
- for (COutput output : vCoins)
- delete output.tx;
- vCoins.clear();
-
// Add coins.
for (int i = 0; i < 1000; i++)
addCoin(1000 * COIN, wallet, vCoins);
@@ -53,6 +48,12 @@ static void CoinSelection(benchmark::State& state)
assert(success);
assert(nValueRet == 1003 * COIN);
assert(setCoinsRet.size() == 2);
+
+ // Empty wallet.
+ for (COutput& output : vCoins) {
+ delete output.tx;
+ }
+ vCoins.clear();
}
}