From: Brian Demsky Date: Thu, 14 Mar 2013 22:39:14 +0000 (-0700) Subject: fix memory leak X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=15762db4e64b528f90fd9bf63a901d4b56b4bc4c fix memory leak when we reuse nodes in the nodestack, we will recreate yield information and leak the old array... --- diff --git a/nodestack.cc b/nodestack.cc index c757af25..b9142435 100644 --- a/nodestack.cc +++ b/nodestack.cc @@ -96,7 +96,8 @@ int Node::get_yield_data(int tid1, int tid2) const { } void Node::update_yield(Scheduler * scheduler) { - yield_data=(int *) model_calloc(1, sizeof(int)*num_threads*num_threads); + if (yield_data==NULL) + yield_data=(int *) model_calloc(1, sizeof(int)*num_threads*num_threads); //handle base case if (parent == NULL) { for(int i = 0; i < num_threads*num_threads; i++) {