From daf85efe675bd6bb4a7f2d4a5fbbfdf321d06bd3 Mon Sep 17 00:00:00 2001 From: q-posev Date: Fri, 8 Jul 2022 17:43:11 +0200 Subject: [PATCH] Fix some memory leaks in the tests --- org/qmckl_ao.org | 1 + org/qmckl_error.org | 3 +++ 2 files changed, 4 insertions(+) diff --git a/org/qmckl_ao.org b/org/qmckl_ao.org index f50dd1c..47877b7 100644 --- a/org/qmckl_ao.org +++ b/org/qmckl_ao.org @@ -2423,6 +2423,7 @@ assert (rc == QMCKL_SUCCESS); for (int64_t i=0 ; i < nucl_num ; ++i) { assert(nucleus_shell_num_test[i] == nucleus_shell_num[i]); } +free(nucleus_shell_num_test); shell_ang_mom_test = (int32_t*) malloc ( shell_num * sizeof(int32_t)); rc = qmckl_get_ao_basis_shell_ang_mom (context, shell_ang_mom_test, shell_num); diff --git a/org/qmckl_error.org b/org/qmckl_error.org index 25721d1..e52f429 100644 --- a/org/qmckl_error.org +++ b/org/qmckl_error.org @@ -577,6 +577,9 @@ if (x < 0) { assert (strcmp(function_name,"qmckl_transpose") == 0); assert (strcmp(message,"Success") == 0); + exit_code = qmckl_context_destroy(context); + assert(exit_code == QMCKL_SUCCESS); + return 0; } #+end_src