Skip to content

Commit

Permalink
Fix another mem leak
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Oct 25, 2024
1 parent fec42bf commit 7ef7100
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 4 additions & 3 deletions include/libsemigroups/froidure-pin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ namespace libsemigroups {
private:
template <typename T>
static constexpr bool IsState
= ((!std::is_void_v<T>) &&std::is_same_v<state_type, T>);
= ((!std::is_void_v<T>) && std::is_same_v<state_type, T>);

////////////////////////////////////////////////////////////////////////
// FroidurePin - data - private
Expand Down Expand Up @@ -544,6 +544,7 @@ namespace libsemigroups {
//! \sa \ref current_position.
[[nodiscard]] const_reference to_element(word_type const& w) const {
throw_if_any_generator_index_out_of_range(w);
// TODO throw if there are no generators and w is empty
return to_element_no_checks(w);
}

Expand Down Expand Up @@ -1301,8 +1302,8 @@ namespace libsemigroups {

void expand(size_type);
void is_one(internal_const_element_type x, element_index_type) noexcept(
std::is_nothrow_default_constructible_v<InternalEqualTo>&& noexcept(
std::declval<InternalEqualTo>()(x, x)));
std::is_nothrow_default_constructible_v<InternalEqualTo>
&& noexcept(std::declval<InternalEqualTo>()(x, x)));

void copy_generators_from_elements(size_t);
void closure_update(element_index_type,
Expand Down
6 changes: 2 additions & 4 deletions include/libsemigroups/froidure-pin.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,8 @@ namespace libsemigroups {
// Consider the empty case separately to avoid the unnecessary
// multiplication by the identity.
if (w.empty()) {
_tmp_product
= this->to_internal(One()(this->to_external_const(_gens[0])));

return this->to_external_const(_tmp_product);
LIBSEMIGROUPS_ASSERT(degree() != UNDEFINED);
return this->to_external_const(_one);
}

// current_position is always known for generators (i.e. when w.size()
Expand Down

0 comments on commit 7ef7100

Please sign in to comment.