From: Brian Norris <banorris@uci.edu>
Date: Thu, 15 Nov 2012 20:43:23 +0000 (-0800)
Subject: model: use snapshot_calloc()
X-Git-Tag: oopsla2013~534
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f465455b6b645c56c92d1c5b7dc47252360b2e63;p=model-checker.git

model: use snapshot_calloc()

Also, might as well free priv on destruction.
---

diff --git a/model.cc b/model.cc
index 1264f68..de3b325 100644
--- a/model.cc
+++ b/model.cc
@@ -56,7 +56,7 @@ ModelChecker::ModelChecker(struct model_params params) :
 	bad_synchronization(false)
 {
 	/* Allocate this "size" on the snapshotting heap */
-	priv = (struct model_snapshot_members *)calloc(1, sizeof(*priv));
+	priv = (struct model_snapshot_members *)snapshot_calloc(1, sizeof(*priv));
 	/* First thread created will have id INITIAL_THREAD_ID */
 	priv->next_thread_id = INITIAL_THREAD_ID;
 
@@ -88,6 +88,8 @@ ModelChecker::~ModelChecker()
 	delete node_stack;
 	delete scheduler;
 	delete mo_graph;
+
+	snapshot_free(priv);
 }
 
 static action_list_t * get_safe_ptr_action(HashTable<const void *, action_list_t *, uintptr_t, 4> * hash, void * ptr) {