Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Assert that there is no memory leak (help scan-build).
[simgrid.git] / src / s4u / s4u_Engine.cpp
index 0576607..aa28e1a 100644 (file)
@@ -55,10 +55,11 @@ Engine::~Engine()
 /** @brief Retrieve the engine singleton */
 Engine* Engine::get_instance()
 {
-  if (s4u::Engine::instance_ == nullptr)
-    return new Engine(0, nullptr);
-  else
-    return s4u::Engine::instance_;
+  if (s4u::Engine::instance_ == nullptr) {
+    auto e = new Engine(0, nullptr);
+    xbt_assert(s4u::Engine::instance_ == e);
+  }
+  return s4u::Engine::instance_;
 }
 
 void Engine::shutdown()