Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix a few memory leaks.
[simgrid.git] / examples / simdag / simdag_trace.c
index b05e5fb..0cdc430 100644 (file)
@@ -92,7 +92,7 @@ int main(int argc, char **argv)
                    &(computation_amount[1]), SD_SCHED_NO_COST, rate);
 
   /* let's launch the simulation! */
-  while (xbt_dynar_length(changed_tasks = SD_simulate(-1.0)) > 0) {
+  while (!xbt_dynar_is_empty(changed_tasks = SD_simulate(-1.0))) {
     for (i = 0; i < 2; i++) {
       task = SD_workstation_get_current_task(workstations[i]);
       if (task)
@@ -124,6 +124,7 @@ int main(int argc, char **argv)
     }
     xbt_dynar_free_container(&changed_tasks);
   }
+  xbt_dynar_free_container(&changed_tasks);
 
   XBT_DEBUG("Destroying tasks...");