Skip to content

Commit 58ebadb

Browse files
siparandom-zebra
authored andcommitted
Fix memory leak in net_tests
1 parent 786f396 commit 58ebadb

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/test/net_tests.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,14 @@ BOOST_AUTO_TEST_CASE(cnode_simple_test)
166166
bool fInboundIn = false;
167167

168168
// Test that fFeeler is false by default.
169-
CNode* pnode1 = new CNode(id++, NODE_NETWORK, height, hSocket, addr, 0, 0, pszDest, fInboundIn);
169+
std::unique_ptr<CNode> pnode1(new CNode(id++, NODE_NETWORK, height, hSocket, addr, 0, 0, pszDest, fInboundIn));
170170
BOOST_CHECK(pnode1->fInbound == false);
171171
BOOST_CHECK(pnode1->fFeeler == false);
172172

173173
fInboundIn = true;
174-
CNode* pnode2 = new CNode(id++, NODE_NETWORK, height, hSocket, addr, 1, 1, pszDest, fInboundIn);
174+
std::unique_ptr<CNode> pnode2(new CNode(id++, NODE_NETWORK, height, hSocket, addr, 1, 1, pszDest, fInboundIn));
175175
BOOST_CHECK(pnode2->fInbound == true);
176176
BOOST_CHECK(pnode2->fFeeler == false);
177-
178-
delete pnode1;
179-
delete pnode2;
180177
}
181178

182179
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)