diff --git a/src/util/lp/lar_core_solver.h b/src/util/lp/lar_core_solver.h index 52290c69a..9dec5aa70 100644 --- a/src/util/lp/lar_core_solver.h +++ b/src/util/lp/lar_core_solver.h @@ -421,9 +421,10 @@ public: unsigned leaving = trace_of_basis_change[i+1]; cs.change_basis_unconditionally(entering, leaving); } - if (cs.m_factorization != nullptr) + if (cs.m_factorization != nullptr) { delete cs.m_factorization; - cs.m_factorization = nullptr; + cs.m_factorization = nullptr; + } } else { indexed_vector w(cs.m_A.row_count()); // the queues of delayed indices diff --git a/src/util/lp/lp_core_solver_base.h b/src/util/lp/lp_core_solver_base.h index 46f683c91..4c17df29c 100644 --- a/src/util/lp/lp_core_solver_base.h +++ b/src/util/lp/lp_core_solver_base.h @@ -127,9 +127,8 @@ public: void init(); virtual ~lp_core_solver_base() { - if (m_factorization != nullptr) - delete m_factorization; - } + delete m_factorization; + } vector & non_basis() { return m_nbasis; diff --git a/src/util/lp/lp_dual_simplex.h b/src/util/lp/lp_dual_simplex.h index 59b1bc24c..c33b55031 100644 --- a/src/util/lp/lp_dual_simplex.h +++ b/src/util/lp/lp_dual_simplex.h @@ -34,9 +34,7 @@ class lp_dual_simplex: public lp_solver { vector m_can_enter_basis; public: ~lp_dual_simplex() override { - if (m_core_solver != nullptr) { - delete m_core_solver; - } + delete m_core_solver; } lp_dual_simplex() : m_core_solver(nullptr) {} diff --git a/src/util/lp/lp_primal_simplex_def.h b/src/util/lp/lp_primal_simplex_def.h index 722e4bd79..ad644838f 100644 --- a/src/util/lp/lp_primal_simplex_def.h +++ b/src/util/lp/lp_primal_simplex_def.h @@ -263,9 +263,7 @@ template void lp_primal_simplex::solve_with_total template lp_primal_simplex::~lp_primal_simplex() { - if (m_core_solver != nullptr) { - delete m_core_solver; - } + delete m_core_solver; } template bool lp_primal_simplex::bounds_hold(std::unordered_map const & solution) { diff --git a/src/util/lp/lp_solver_def.h b/src/util/lp/lp_solver_def.h index d18333161..04603f4a7 100644 --- a/src/util/lp/lp_solver_def.h +++ b/src/util/lp/lp_solver_def.h @@ -86,9 +86,7 @@ template int lp_solver::get_column_index_by_name( template lp_solver::~lp_solver(){ - if (m_A != nullptr) { - delete m_A; - } + delete m_A; for (auto t : m_map_from_var_index_to_column_info) { delete t.second; }