diff options
author | Morgan Deters <mdeters@cs.nyu.edu> | 2014-11-07 17:55:30 -0500 |
---|---|---|
committer | Morgan Deters <mdeters@cs.nyu.edu> | 2014-11-07 17:55:30 -0500 |
commit | 5b608987fd2971b0628973301dd52c0fc46d1a09 (patch) | |
tree | cb90896cb96ccf4de1d36237f11d66eca7079972 | |
parent | 89ed50fd35e6425ed7f1fa4ca5ec560acee1358e (diff) |
Fix a memory leak in SatSolverRegistry (re: bug #594).
-rw-r--r-- | src/prop/sat_solver_factory.cpp | 4 | ||||
-rw-r--r-- | src/prop/sat_solver_factory.h | 9 | ||||
-rw-r--r-- | src/prop/sat_solver_registry.cpp | 3 | ||||
-rw-r--r-- | src/prop/sat_solver_registry.h | 5 |
4 files changed, 9 insertions, 12 deletions
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<std::string>& 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<std::string>& 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<typename Solver> const size_t SatSolverConstructor<Solver>::s_solverId = SatSolverRegistry::getInstance()->registerSolver<SatSolverConstructor>(typeid(Solver).name()); -} -} - +}/* CVC4::prop namespace */ +}/* CVC4 namespace */ |