From 1657ed2ab4e4b50e878570d2e2a5f84829192a14 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 19 Sep 2013 00:01:36 +0200 Subject: [PATCH] Fix minor unit test memory leaks --- src/test/miner_tests.cpp | 4 ++++ src/test/wallet_tests.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index 818350414..eeeacb0ad 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -83,6 +83,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) // Just to make sure we can still make simple blocks BOOST_CHECK(pblocktemplate = CreateNewBlockWithKey(reservekey)); + delete pblocktemplate; // block sigops > limit: 1000 CHECKMULTISIG + 1 tx.vin.resize(1); @@ -200,6 +201,9 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) BOOST_CHECK(pblocktemplate = CreateNewBlockWithKey(reservekey)); delete pblocktemplate; pindexBest->nHeight = nHeight; + + BOOST_FOREACH(CTransaction *tx, txFirst) + delete tx; } BOOST_AUTO_TEST_CASE(sha256transform_equality) diff --git a/src/test/wallet_tests.cpp b/src/test/wallet_tests.cpp index a14f6b2b7..51f3b27c8 100644 --- a/src/test/wallet_tests.cpp +++ b/src/test/wallet_tests.cpp @@ -289,6 +289,7 @@ BOOST_AUTO_TEST_CASE(coin_selection_tests) BOOST_CHECK_NE(fails, RANDOM_REPEATS); } } + empty_wallet(); } BOOST_AUTO_TEST_SUITE_END()