From 66202af917537abe68a6c9e1a9808c062faf8a9b Mon Sep 17 00:00:00 2001 From: David Boehme Date: Thu, 6 Nov 2025 12:42:47 -0800 Subject: [PATCH] Free the tool list in adiak_clean() --- src/adiak.c | 10 +++++++++- tests/test_zerocopy.c | 2 +- tests/testapp.c | 3 +-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/adiak.c b/src/adiak.c index 42717dc..96776f1 100644 --- a/src/adiak.c +++ b/src/adiak.c @@ -1158,9 +1158,17 @@ int adiak_clean() record_hash = adiak_config->record_hash; memset(record_hash, 0, sizeof(local_record_hash)); - adiak_config->shared_record_list = NULL; + if (adiak_config->tool_list != NULL) { + adiak_tool_t* next_tool = NULL; + for (adiak_tool_t* tool = (*adiak_config->tool_list); tool != NULL; tool = next_tool) { + next_tool = tool->next; + free(tool); + } + adiak_config->tool_list = NULL; + } + return result; } diff --git a/tests/test_zerocopy.c b/tests/test_zerocopy.c index 1f856ae..9d6701a 100644 --- a/tests/test_zerocopy.c +++ b/tests/test_zerocopy.c @@ -101,8 +101,8 @@ int main( int result = adiak_flush("stdout"); if (result != 0) printf("return: %d\n\n", result); - adiak_clean(); adiak_fini(); + adiak_clean(); #if defined(USE_MPI) MPI_Finalize(); diff --git a/tests/testapp.c b/tests/testapp.c index b3153d0..0288f80 100644 --- a/tests/testapp.c +++ b/tests/testapp.c @@ -81,9 +81,8 @@ int main( dowork(start); dowork(start); - adiak_clean(); - adiak_fini(); + adiak_clean(); #if defined(USE_MPI) MPI_Finalize();