diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-02-17 14:29:56 -0500 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-02-22 14:53:14 -0500 |
commit | fadb39ca6237781346ca3da319e2bd9e48a5a604 (patch) | |
tree | 1f441104a6e3bd684d1a7c1e3669b07615a437f0 /src/bench/coin_selection.cpp | |
parent | 27c59dc502f29cf1d76290556c21e366145e3b2e (diff) |
test: Plug memory leaks and stack-use-after-scope
Diffstat (limited to 'src/bench/coin_selection.cpp')
-rw-r--r-- | src/bench/coin_selection.cpp | 11 |
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(); } } |