From: Andres Noetzli Date: Mon, 29 Jun 2020 20:01:09 +0000 (-0700) Subject: Fix memory leak in unit test node_algorithm_black (#4670) X-Git-Tag: cvc5-1.0.0~3168 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8799bd979c40477d250cada8b498ce344ae61ab6;p=cvc5.git 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. --- 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; };