Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
plug another memleak by not mallocating in the first place
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 19 May 2018 14:03:26 +0000 (16:03 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 19 May 2018 14:03:26 +0000 (16:03 +0200)
src/plugins/vm/s4u_VirtualMachine.cpp

index d603636..0703e8d 100644 (file)
@@ -35,11 +35,11 @@ VirtualMachine::VirtualMachine(const char* name, s4u::Host* pm, int coreAmount,
   pimpl_netpoint = pm->pimpl_netpoint;
 
   // Create a VCPU for this VM
-  std::vector<double>* speeds = new std::vector<double>();
+  std::vector<double> speeds;
   for (int i = 0; i < pm->getPstatesCount(); i++)
-    speeds->push_back(pm->getPstateSpeed(i));
+    speeds.push_back(pm->getPstateSpeed(i));
 
-  surf_cpu_model_vm->createCpu(this, speeds, pm->getCoreCount());
+  surf_cpu_model_vm->createCpu(this, &speeds, pm->getCoreCount());
   if (pm->getPstate() != 0)
     setPstate(pm->getPstate());