Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please sonar
[simgrid.git] / examples / s4u / actor-create / s4u_actor-create.cpp
index f4146a5..56c2849 100644 (file)
@@ -30,9 +30,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor_create, "The logging channel used in this
 class Sender {
 public:
   std::string msg = "GaBuZoMeu";
-  explicit Sender(){
-      /* Constructor used when no parameter is passed to the actor */
-  };
+  explicit Sender() = default;
   explicit Sender(std::vector<std::string> args)
   {
     /* This constructor is used when we pass parameters to the actor */
@@ -79,6 +77,8 @@ public:
     char* msg1 = static_cast<char*>(simgrid::s4u::this_actor::recv(mailbox));
     char* msg2 = static_cast<char*>(simgrid::s4u::this_actor::recv(mailbox));
     XBT_INFO("I received '%s' and '%s'", msg1, msg2);
+    xbt_free(msg1);
+    xbt_free(msg2);
     XBT_INFO("I'm done. See you.");
   }
 };
@@ -114,5 +114,7 @@ int main(int argc, char** argv)
   e->run();
 
   /* Once the simulation is done, the program is ended */
+  delete e;
+
   return 0;
 }