Fixed the memory leaks in the constraint solver.