nodestack: destroy Nodes properly in ~NodeStack()
[model-checker.git] / nodestack.cc
index a73765320dac47e97428390fe37bc3b06ba10483..6b1d4ef9c86929fdd14d14172149abaacec96133 100644 (file)
@@ -362,16 +362,18 @@ void Node::explore(thread_id_t tid)
        explored_children[i] = true;
 }
 
-NodeStack::NodeStack()
-       : total_nodes(0)
+NodeStack::NodeStack() :
+       node_list(1, new Node()),
+       iter(0),
+       total_nodes(0)
 {
-       node_list.push_back(new Node());
        total_nodes++;
-       iter = 0;
 }
 
 NodeStack::~NodeStack()
 {
+       for (unsigned int i = 0; i < node_list.size(); i++)
+               delete node_list[i];
 }
 
 void NodeStack::print()