From 41375b2b9f4a877ee4c33c67f9162c9c2efe1629 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Thu, 2 Nov 2023 16:18:08 -0400 Subject: [PATCH] free `ParsecRuntime::madness_comm_thread_es` even if MADWorld did not create the context --- src/madness/world/parsec.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/madness/world/parsec.cc b/src/madness/world/parsec.cc index 555c822c586..2e4c7f94f4e 100644 --- a/src/madness/world/parsec.cc +++ b/src/madness/world/parsec.cc @@ -226,13 +226,13 @@ namespace madness { if (*made_new_ctx) { parsec_context_wait(ctx); parsec_fini(&ctx); - if (nullptr != madness_comm_thread_es) { + ctx = nullptr; + } + if (nullptr != madness_comm_thread_es) { /* madness_comm_thread_es is just a copy of ES[0]. Resources (including es->profiling_es) are * actually freed during parsec_fini. Just need to free memory allocated to store it. */ free(madness_comm_thread_es); madness_comm_thread_es = nullptr; - } - ctx = nullptr; } }