From: Morgan Deters Date: Fri, 7 Nov 2014 22:55:30 +0000 (-0500) Subject: Fix a memory leak in SatSolverRegistry (re: bug #594). X-Git-Tag: cvc5-1.0.0~6515 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5b608987fd2971b0628973301dd52c0fc46d1a09;p=cvc5.git Fix a memory leak in SatSolverRegistry (re: bug #594). --- diff --git a/src/prop/sat_solver_factory.cpp b/src/prop/sat_solver_factory.cpp index 650c05dd4..3d3e76205 100644 --- a/src/prop/sat_solver_factory.cpp +++ b/src/prop/sat_solver_factory.cpp @@ -46,5 +46,5 @@ void SatSolverFactory::getSolverIds(std::vector& solvers) { SatSolverRegistry::getSolverIds(solvers); } -} /* namespace CVC4::prop */ -} /* namespace CVC4 */ +} /* CVC4::prop namespace */ +} /* CVC4 namespace */ diff --git a/src/prop/sat_solver_factory.h b/src/prop/sat_solver_factory.h index 0b419d545..009622212 100644 --- a/src/prop/sat_solver_factory.h +++ b/src/prop/sat_solver_factory.h @@ -36,10 +36,7 @@ public: /** Get the solver ids that are available */ static void getSolverIds(std::vector& solvers); -}; - -} -} - - +};/* class SatSolverFactory */ +}/* CVC4::prop namespace */ +}/* CVC4 namespace */ diff --git a/src/prop/sat_solver_registry.cpp b/src/prop/sat_solver_registry.cpp index 7867c6cc3..5cf79699f 100644 --- a/src/prop/sat_solver_registry.cpp +++ b/src/prop/sat_solver_registry.cpp @@ -52,8 +52,9 @@ SatSolverRegistry* SatSolverRegistry::getInstance() { SatSolverRegistry::~SatSolverRegistry() { registry_type::const_iterator it = d_solvers.begin(); - registry_type::const_iterator it_end = d_solvers.begin(); + registry_type::const_iterator it_end = d_solvers.end(); for (; it != it_end; ++ it) { delete it->second; } + d_solvers.clear(); } diff --git a/src/prop/sat_solver_registry.h b/src/prop/sat_solver_registry.h index b8173866f..7a326d6c8 100644 --- a/src/prop/sat_solver_registry.h +++ b/src/prop/sat_solver_registry.h @@ -111,6 +111,5 @@ public: template const size_t SatSolverConstructor::s_solverId = SatSolverRegistry::getInstance()->registerSolver(typeid(Solver).name()); -} -} - +}/* CVC4::prop namespace */ +}/* CVC4 namespace */