From fb084fdff48739eb642a31dfdd96447b91942be7 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 20 Jun 2019 20:42:42 +0200 Subject: [PATCH] memory leaks in H5Port core functions fixed --- src/h5core/h5u_io.c | 1 + src/h5core/h5u_model.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/h5core/h5u_io.c b/src/h5core/h5u_io.c index be5959a..ba58bff 100644 --- a/src/h5core/h5u_io.c +++ b/src/h5core/h5u_io.c @@ -254,5 +254,6 @@ h5u_write_dataset ( hid_t dset_id; TRY (dset_id = h5u_open_dataset (fh, name, type)); TRY (h5u_write (fh, dset_id, type, data)); + TRY (hdf5_close_dataset(dset_id)); H5_RETURN (H5_SUCCESS); } diff --git a/src/h5core/h5u_model.c b/src/h5core/h5u_model.c index 27c8bbf..90008ac 100644 --- a/src/h5core/h5u_model.c +++ b/src/h5core/h5u_model.c @@ -152,6 +152,8 @@ h5u_set_num_items ( TRY (hdf5_close_dataspace (u->shape)); u->shape = H5S_ALL; + TRY (hdf5_close_dataspace (u->memshape)); + u->memshape = H5S_ALL; u->nparticles = (hsize_t)nparticles; @@ -212,7 +214,8 @@ h5u_set_num_items ( TRY( u->shape = hdf5_create_dataspace(1, &count, NULL) ); /* declare overall data size but then will select a subset */ - TRY( u->diskshape = hdf5_create_dataspace(1, &count, NULL) ); + TRY (hdf5_close_dataspace (u->diskshape)); + TRY (u->diskshape = hdf5_create_dataspace(1, &count, NULL)); count = nparticles; if (count > 0) {