Skip to content

Commit

Permalink
action: fix mem leak in init
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Apr 26, 2024
1 parent 64df9f1 commit 689ee21
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/libsemigroups/action.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ namespace libsemigroups {
_graph.init();
_map.clear();
_options.init();
for (auto pt : _orb) {
this->internal_free(pt);
}
_orb.clear();
_pos = 0;
_scc.init(_graph);
Expand Down
9 changes: 9 additions & 0 deletions tests/test-action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,15 @@ namespace libsemigroups {
o.add_generator(PPerm<8>({1, 2, 3, 4, 5, 6, 7}, {0, 1, 2, 3, 4, 5, 6}, 8));
o.add_generator(PPerm<8>({0, 1, 2, 3, 4, 5, 6}, {1, 2, 3, 4, 5, 6, 7}, 8));
REQUIRE(o.size() == 256);
o.init(); // Test init with non-trivial point_type
o.add_seed(PPerm<8>::identity(8));
o.add_generator(
PPerm<8>({0, 1, 2, 3, 4, 5, 6, 7}, {1, 2, 3, 4, 5, 6, 7, 0}, 8));
o.add_generator(
PPerm<8>({0, 1, 2, 3, 4, 5, 6, 7}, {1, 0, 2, 3, 4, 5, 6, 7}, 8));
o.add_generator(PPerm<8>({1, 2, 3, 4, 5, 6, 7}, {0, 1, 2, 3, 4, 5, 6}, 8));
o.add_generator(PPerm<8>({0, 1, 2, 3, 4, 5, 6}, {1, 2, 3, 4, 5, 6, 7}, 8));
REQUIRE(o.size() == 256);
}

LIBSEMIGROUPS_TEST_CASE_V3("Action",
Expand Down

0 comments on commit 689ee21

Please sign in to comment.