Fix a memory leak in SatSolverRegistry (re: bug #594).
authorMorgan Deters <mdeters@cs.nyu.edu>
Fri, 7 Nov 2014 22:55:30 +0000 (17:55 -0500)
committerMorgan Deters <mdeters@cs.nyu.edu>
Fri, 7 Nov 2014 22:55:30 +0000 (17:55 -0500)
src/prop/sat_solver_factory.cpp
src/prop/sat_solver_factory.h
src/prop/sat_solver_registry.cpp
src/prop/sat_solver_registry.h

index 650c05dd46fd826da83d0e204997fea8c8bab815..3d3e76205b443d2ea9782aaae6b4cde0ff324988 100644 (file)
@@ -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 */
index 0b419d545dbc550e0310fa2039f98f1371d2bdce..0096222124acd5d0b4829f9b48f1f33bb106eb68 100644 (file)
@@ -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 */
index 7867c6cc3b4f94959ebffa96e7c3148bc610d47f..5cf79699f9178fca30967e87579a13e79c33af0e 100644 (file)
@@ -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();
 }
index b8173866f317a60d3fd85306ac952db84d92770b..7a326d6c897b18315f992faf333ff7ee87be9ab4 100644 (file)
@@ -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 */