Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix Memleaks
[simgrid.git] / src / surf / vm_workstation.cpp
index 072942c..4f2dbc6 100644 (file)
@@ -8,8 +8,10 @@
 #include "cpu_cas01.hpp"
 #include "maxmin_private.h"
 
+extern "C" {
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm_workstation, surf,
                                 "Logging specific to the SURF VM workstation module");
+}
 
 WorkstationVMModelPtr surf_vm_workstation_model = NULL;
 
@@ -181,10 +183,10 @@ double WorkstationVMModel::shareResources(double now)
 
 WorkstationVM2013Lmm::WorkstationVM2013Lmm(WorkstationVMModelPtr model, const char* name, xbt_dict_t props,
                                                   surf_resource_t ind_phys_workstation)
-  :  WorkstationVM2013(model, name, props, NULL, NULL),
-     WorkstationCLM03Lmm(model, name, props, NULL, NULL, NULL),
+  :  Resource(model, name, props),
      WorkstationCLM03(model, name, props, NULL, NULL, NULL),
-     Resource(model, name, props) {
+     WorkstationVM2013(model, name, props, NULL, NULL),
+     WorkstationCLM03Lmm(model, name, props, NULL, NULL, NULL) {
   WorkstationCLM03Ptr sub_ws = dynamic_cast<WorkstationCLM03Ptr>(
                                static_cast<ResourcePtr>(
                                  surf_workstation_resource_priv(ind_phys_workstation)));
@@ -273,17 +275,14 @@ WorkstationVM2013Lmm::~WorkstationVM2013Lmm()
   /* Free the cpu resource of the VM. If using power_trace, we will have to
    * free other objects than lmm_constraint. */
   lmm_constraint_free(cpu->p_model->p_maxminSystem, cpu->p_constraint);
-  {
-    unsigned long i;
-    for (i = 0; i < cpu->m_core; i++) {
-      void *cnst_id = cpu->p_constraintCore[i]->id;
-      lmm_constraint_free(cpu->p_model->p_maxminSystem, cpu->p_constraintCore[i]);
-      xbt_free(cnst_id);
-    }
-
-    xbt_free(cpu->p_constraintCore);
+  for (int i = 0; i < cpu->m_core; i++) {
+    void *cnst_id = cpu->p_constraintCore[i]->id;
+    lmm_constraint_free(cpu->p_model->p_maxminSystem, cpu->p_constraintCore[i]);
+    xbt_free(cnst_id);
   }
 
+  xbt_free(cpu->p_constraintCore);
+
   delete cpu;
 
   /* Free the network resource of the VM. */