Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Engine should be destroyed through RAII here (fix invalid free).
[simgrid.git] / teshsuite / s4u / comm-pt2pt / comm-pt2pt.cpp
index 8c21ecc..07838b5 100644 (file)
@@ -16,7 +16,7 @@
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
 
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
 
-XBT_ATTRIB_NORETURN static void usage(const char* binaryName, const char* defaultSend, const char* defaultRecv)
+static void usage(const char* binaryName, const char* defaultSend, const char* defaultRecv)
 {
   std::fprintf(stderr, "Usage: %s examples/platforms/cluster_backbone.xml <send_spec> <recv_spec>\n"
                        "where spec is a list of letters giving the kind of tests you want to see.\n"
 {
   std::fprintf(stderr, "Usage: %s examples/platforms/cluster_backbone.xml <send_spec> <recv_spec>\n"
                        "where spec is a list of letters giving the kind of tests you want to see.\n"
@@ -40,7 +40,6 @@ XBT_ATTRIB_NORETURN static void usage(const char* binaryName, const char* defaul
                        "Example 1: %s examples/platforms/cluster_backbone.xml rRiIdD rrrrrr # testing all send functions\n"
                        "Default specs: %s %s (all possible pairs)\n",
                binaryName, binaryName, defaultSend, defaultRecv);
                        "Example 1: %s examples/platforms/cluster_backbone.xml rRiIdD rrrrrr # testing all send functions\n"
                        "Default specs: %s %s (all possible pairs)\n",
                binaryName, binaryName, defaultSend, defaultRecv);
-  exit(1);
 }
 
 static void sender(std::vector<std::string> args)
 }
 
 static void sender(std::vector<std::string> args)
@@ -165,8 +164,10 @@ int main(int argc, char* argv[])
   std::vector<std::string> argRecv{specRecv.c_str()};
 
   simgrid::s4u::Engine e(&argc, argv);
   std::vector<std::string> argRecv{specRecv.c_str()};
 
   simgrid::s4u::Engine e(&argc, argv);
-  if (argc < 2)
+  if (argc < 2) {
     usage(argv[0], specSend.c_str(), specRecv.c_str());
     usage(argv[0], specSend.c_str(), specRecv.c_str());
+    return 1;
+  }
 
   e.load_platform(argv[1]);
 
 
   e.load_platform(argv[1]);