diff options
author | Thomas White <taw@physics.org> | 2022-09-20 14:37:24 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2022-09-20 14:37:24 +0200 |
commit | 55188747562dfbfb95f5ec2b23d36aa91557324c (patch) | |
tree | 6a96dd1f5313975e7e883beaa9277a655e81dcd7 | |
parent | 6d18e4ba3edd077aba9811d446d94f16141f57e9 (diff) |
load_hdf5_hyperslab: Add missing cleanup
-rw-r--r-- | libcrystfel/src/image-hdf5.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libcrystfel/src/image-hdf5.c b/libcrystfel/src/image-hdf5.c index d615df88..0da2898f 100644 --- a/libcrystfel/src/image-hdf5.c +++ b/libcrystfel/src/image-hdf5.c @@ -415,6 +415,7 @@ static int load_hdf5_hyperslab(struct panel_template *p, if ( ndims < 0 ) { ERROR("Failed to get number of dimensions for panel %s\n", p->name); + H5Dclose(dh); return 1; } @@ -435,6 +436,7 @@ static int load_hdf5_hyperslab(struct panel_template *p, "panel %s (%i, but expected %i or %i)\n", p->name, ndims, total_dt_dims, total_dt_dims - plh_dt_dims); + H5Dclose(dh); return 1; } } else { @@ -449,6 +451,9 @@ static int load_hdf5_hyperslab(struct panel_template *p, f_count = malloc(ndims*sizeof(hsize_t)); if ( (f_offset == NULL) || (f_count == NULL ) ) { ERROR("Failed to allocate offset or count.\n"); + free(f_offset); + free(f_count); + H5Dclose(dh); return 1; } @@ -497,6 +502,7 @@ static int load_hdf5_hyperslab(struct panel_template *p, p->name); free(f_offset); free(f_count); + H5Dclose(dh); return 1; } @@ -513,12 +519,15 @@ static int load_hdf5_hyperslab(struct panel_template *p, free(f_offset); free(f_count); free(data); + H5Dclose(dh); return 1; } free(f_offset); free(f_count); + H5Dclose(dh); + return 0; } |