diff options
| author | MarcoFalke <[email protected]> | 2018-02-17 14:29:56 -0500 |
|---|---|---|
| committer | MarcoFalke <[email protected]> | 2018-02-22 14:53:14 -0500 |
| commit | fadb39ca6237781346ca3da319e2bd9e48a5a604 (patch) | |
| tree | 1f441104a6e3bd684d1a7c1e3669b07615a437f0 /src/bench/coin_selection.cpp | |
| parent | Merge #12464: Revert "[tests] bind functional test nodes to 127.0.0.1" (diff) | |
| download | discoin-fadb39ca6237781346ca3da319e2bd9e48a5a604.tar.xz discoin-fadb39ca6237781346ca3da319e2bd9e48a5a604.zip | |
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 06d2abeac..6f438b60e 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(); } } |