summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2020-06-29 13:01:09 -0700
committerGitHub <noreply@github.com>2020-06-29 15:01:09 -0500
commit8799bd979c40477d250cada8b498ce344ae61ab6 (patch)
treef9008f4e04a8aee9c142e36f3a5e126d311ab1d1
parent46591b1c92fc9ecd4a0997242030a1a48166301b (diff)
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.
-rw-r--r--test/unit/expr/node_algorithm_black.h17
1 files 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;
};
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback