diff --git a/src/hdf5/HDF5IO.cpp b/src/hdf5/HDF5IO.cpp index 58fe39e0..36601a75 100644 --- a/src/hdf5/HDF5IO.cpp +++ b/src/hdf5/HDF5IO.cpp @@ -352,7 +352,14 @@ Status HDF5IO::createReferenceDataSet( delete[] rdata; herr_t dsetStatus = H5Dclose(dset); + if (checkStatus(dsetStatus) == Status::Failure) { + return Status::Failure; + } + herr_t spaceStatus = H5Sclose(space); + if (checkStatus(spaceStatus) == Status::Failure) { + return Status::Failure; + } return checkStatus(writeStatus); } @@ -639,20 +646,19 @@ HDF5RecordingData::HDF5RecordingData(std::unique_ptr data) DataSpace dSpace = data->getSpace(); DSetCreatPropList prop = data->getCreatePlist(); - int nDimensions = dSpace.getSimpleExtentNdims(); - std::vector dims(nDimensions), chunk(nDimensions); + this->nDimensions = dSpace.getSimpleExtentNdims(); + std::vector dims(this->nDimensions), chunk(this->nDimensions); nDimensions = dSpace.getSimpleExtentDims( dims.data()); // TODO -redefine here or use original? - prop.getChunk(static_cast(nDimensions), chunk.data()); + prop.getChunk(static_cast(this->nDimensions), chunk.data()); - this->size = std::vector(nDimensions); - for (int i = 0; i < nDimensions; ++i) { + this->size = std::vector(this->nDimensions); + for (int i = 0; i < this->nDimensions; ++i) { this->size[i] = dims[i]; } - this->nDimensions = nDimensions; this->position = std::vector( - nDimensions, 0); // Initialize position with 0 for each dimension + this->nDimensions, 0); // Initialize position with 0 for each dimension this->dSet = std::make_unique(*data); }