Skip to content

Commit 5a0b7e4

Browse files
committed
Fix memory leak in net_tests
1 parent 6b03bfb commit 5a0b7e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/test/net_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ BOOST_AUTO_TEST_CASE(cnode_simple_test)
162162
bool fInboundIn = false;
163163

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

169169
fInboundIn = true;
170-
CNode* pnode2 = new CNode(id++, NODE_NETWORK, height, hSocket, addr, 1, 1, pszDest, fInboundIn);
170+
std::unique_ptr<CNode> pnode2(new CNode(id++, NODE_NETWORK, height, hSocket, addr, 1, 1, pszDest, fInboundIn));
171171
BOOST_CHECK(pnode2->fInbound == true);
172172
BOOST_CHECK(pnode2->fFeeler == false);
173173
}

0 commit comments

Comments
 (0)