summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2020-06-29 12:07:27 -0700
committerAndres Noetzli <andres.noetzli@gmail.com>2020-06-29 12:07:27 -0700
commit1fc067507735939eed6fa595915ad53d18954fe0 (patch)
treef9008f4e04a8aee9c142e36f3a5e126d311ab1d1
parent46591b1c92fc9ecd4a0997242030a1a48166301b (diff)
Fix memory leak in unit test node_algorithm_blackfix4658
Commit ccd4500c03685952ebf571b3539bd9e29c829cb5 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`.
-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