fix edge case
[c11tester.git] / history.cc
index d334cb7de10cc3141cd86d5942107155d70ffb9e..c15bb26fff72241bde7bd64ea0dcb87fcac091c7 100644 (file)
@@ -190,7 +190,7 @@ void ModelHistory::process_action(ModelAction *act, thread_id_t tid)
                func_node->update_inst_act_map(tid, act);
 
                Fuzzer * fuzzer = model->get_execution()->getFuzzer();
-               Predicate * selected_branch = fuzzer->get_selected_child_branch(tid);
+               Predicate * selected_branch = ((NewFuzzer *)fuzzer)->get_selected_child_branch(tid);
                func_node->set_predicate_tree_position(tid, selected_branch);
        }
 
@@ -363,7 +363,7 @@ void ModelHistory::check_waiting_write(ModelAction * write_act)
                        Thread * thread = model->get_thread(tid);
 
                        //model_print("** thread %d is woken up\n", thread->get_id());
-                       model->get_execution()->getFuzzer()->notify_paused_thread(thread);
+                       ((NewFuzzer *)model->get_execution()->getFuzzer())->notify_paused_thread(thread);
                }
 
                index++;
@@ -410,6 +410,7 @@ void ModelHistory::remove_waiting_thread(thread_id_t tid)
        }
 
        self_wait_obj->clear_waiting_for();
+       delete iter;
 }
 
 void ModelHistory::stop_waiting_for_node(thread_id_t self_id,
@@ -430,7 +431,7 @@ void ModelHistory::stop_waiting_for_node(thread_id_t self_id,
                        // model_print("\tthread %d waits for nobody, wake up\n", self_id);
                        ModelExecution * execution = model->get_execution();
                        Thread * thread = execution->get_thread(self_id);
-                       execution->getFuzzer()->notify_paused_thread(thread);
+                       ((NewFuzzer *)execution->getFuzzer())->notify_paused_thread(thread);
                }
        }
 }
@@ -503,7 +504,11 @@ void ModelHistory::monitor_waiting_thread(uint32_t func_id, thread_id_t tid)
                                stop_waiting_for_node(waited_by_id, tid, target);
                        }
                }
+
+               delete node_iter;
        }
+
+       delete tid_iter;
 }
 
 void ModelHistory::monitor_waiting_thread_counter(thread_id_t tid)
@@ -528,10 +533,12 @@ void ModelHistory::monitor_waiting_thread_counter(thread_id_t tid)
                                // model_print("\tthread %d waits for nobody, wake up\n", self_id);
                                ModelExecution * execution = model->get_execution();
                                Thread * thread = execution->get_thread(waited_by_id);
-                               execution->getFuzzer()->notify_paused_thread(thread);
+                               ((NewFuzzer *)execution->getFuzzer())->notify_paused_thread(thread);
                        }
                }
        }
+
+       delete tid_iter;
 }
 
 /* Reallocate some snapshotted memories when new executions start */