Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
And 2 memleaks in simdag examples
[simgrid.git] / examples / simdag / daxload / sd_daxload.c
index 1734949..50391f4 100644 (file)
@@ -64,23 +64,26 @@ int main(int argc, char **argv)
 
   /* Schedule them all on the first host */
   XBT_INFO("------------------- Schedule tasks ---------------------------");
 
   /* Schedule them all on the first host */
   XBT_INFO("------------------- Schedule tasks ---------------------------");
-  const sg_host_t *ws_list = sg_host_list();
+  sg_host_t *host_list = sg_host_list();
   int hosts_count = sg_host_count();
   int hosts_count = sg_host_count();
-  qsort((void *) ws_list, hosts_count, sizeof(sg_host_t), name_compare_hosts);
+  qsort((void *) host_list, hosts_count, sizeof(sg_host_t), name_compare_hosts);
 
   xbt_dynar_foreach(dax, cursor, task) {
     if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ) {
       if (!strcmp(SD_task_get_name(task), "end"))
 
   xbt_dynar_foreach(dax, cursor, task) {
     if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ) {
       if (!strcmp(SD_task_get_name(task), "end"))
-        SD_task_schedulel(task, 1, ws_list[0]);
+        SD_task_schedulel(task, 1, host_list[0]);
       else
       else
-        SD_task_schedulel(task, 1, ws_list[cursor % hosts_count]);
+        SD_task_schedulel(task, 1, host_list[cursor % hosts_count]);
     }
   }
     }
   }
+  xbt_free(host_list);
 
   XBT_INFO("------------------- Run the schedule ---------------------------");
   SD_simulate(-1);
   XBT_INFO("------------------- Produce the trace file---------------------------");
 
   XBT_INFO("------------------- Run the schedule ---------------------------");
   SD_simulate(-1);
   XBT_INFO("------------------- Produce the trace file---------------------------");
-  XBT_INFO("Producing the trace of the run into %s", xbt_basename(tracefilename));
+  char * basename = xbt_basename(tracefilename);
+  XBT_INFO("Producing the trace of the run into %s", basename);
+  free(basename);
   FILE *out = fopen(tracefilename, "w");
   xbt_assert(out, "Cannot write to %s", tracefilename);
   free(tracefilename);
   FILE *out = fopen(tracefilename, "w");
   xbt_assert(out, "Cannot write to %s", tracefilename);
   free(tracefilename);