From 13348ab9159827fcf6afa4e951dd8bd678c9bcca Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 5 Mar 2024 13:16:17 -0800 Subject: Fix a memory leak in the cmpd_dset test (#4071) This was due to not freeing a test buffer. It was not a core library memory leak. --- test/cmpd_dset.c | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 460c8ae..1d56412 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -1115,6 +1115,7 @@ test_select_compound(char *fname, hid_t fapl, hid_t in_dxpl, unsigned set_fillva /* Release buffers */ free(s1); + free(save_s1); free(s3); free(save_s3); free(rbuf1); @@ -1145,30 +1146,19 @@ error: H5E_END_TRY /* Release resources */ - if (s1) - free(s1); - if (s3) - free(s3); - if (save_s3) - free(save_s3); - if (rbuf1) - free(rbuf1); - if (rbuf3) - free(rbuf3); - if (s7) - free(s7); - if (save_s7) - free(save_s7); - if (s8) - free(s8); - if (save_s8) - free(save_s8); - if (rbuf7) - free(rbuf7); - if (rbuf8) - free(rbuf8); - if (save_rbuf8) - free(save_rbuf8); + free(s1); + free(save_s1); + free(s3); + free(save_s3); + free(rbuf1); + free(rbuf3); + free(s7); + free(save_s7); + free(s8); + free(save_s8); + free(rbuf7); + free(rbuf8); + free(save_rbuf8); printf("\n*** SELECT COMPOUND DATASET TESTS FAILED ***\n"); return 1; -- cgit v0.12