From 8799bd979c40477d250cada8b498ce344ae61ab6 Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Mon, 29 Jun 2020 13:01:09 -0700 Subject: [PATCH] Fix memory leak in unit test node_algorithm_black (#4670) Commit ccd4500 modified the unit test node_algorithm_black. It added d_bvTypeNode as a data member to the class and initialized it in setUp() but did not free it in tearDown(), which set off ASan. This commit fixes tearDown() to free d_bvTypeNode. Marking this as major because it should fix the nightlies. --- test/unit/expr/node_algorithm_black.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/unit/expr/node_algorithm_black.h b/test/unit/expr/node_algorithm_black.h index 1f799cd40..7505215e7 100644 --- a/test/unit/expr/node_algorithm_black.h +++ b/test/unit/expr/node_algorithm_black.h @@ -32,13 +32,6 @@ using namespace CVC4::kind; class NodeAlgorithmBlack : public CxxTest::TestSuite { - private: - NodeManager* d_nodeManager; - NodeManagerScope* d_scope; - TypeNode* d_intTypeNode; - TypeNode* d_boolTypeNode; - TypeNode* d_bvTypeNode; - public: void setUp() override { @@ -51,8 +44,9 @@ class NodeAlgorithmBlack : public CxxTest::TestSuite void tearDown() override { - delete d_intTypeNode; + delete d_bvTypeNode; delete d_boolTypeNode; + delete d_intTypeNode; delete d_scope; delete d_nodeManager; } @@ -216,4 +210,11 @@ class NodeAlgorithmBlack : public CxxTest::TestSuite TS_ASSERT_EQUALS(subs.size(), 1); TS_ASSERT_EQUALS(subs[x], a); } + + private: + NodeManager* d_nodeManager; + NodeManagerScope* d_scope; + TypeNode* d_intTypeNode; + TypeNode* d_boolTypeNode; + TypeNode* d_bvTypeNode; }; -- 2.30.2