aboutsummaryrefslogtreecommitdiff
path: root/src/hdf5-file.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-04-06 17:47:28 +0200
committerThomas White <taw@physics.org>2010-04-06 17:47:28 +0200
commit5118da14ff063fec23240b116b0fed15a07d5c67 (patch)
tree84045832dd0e540c18b677aa65d3e7e5e37ce3ef /src/hdf5-file.c
parent1932df41cf4a71c2a89a134a20b9e6e1f65bc31f (diff)
Clean up HDF5 groups on the stack
Diffstat (limited to 'src/hdf5-file.c')
-rw-r--r--src/hdf5-file.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/hdf5-file.c b/src/hdf5-file.c
index c2f002ae..cb24fa48 100644
--- a/src/hdf5-file.c
+++ b/src/hdf5-file.c
@@ -100,14 +100,10 @@ int hdfile_get_height(struct hdfile *f)
static void cleanup(hid_t fh)
{
- int n_objs, n_ids, i;
- hid_t *ids;
+ int n_ids, i;
+ hid_t ids[256];
- n_objs = H5Fget_obj_count(fh, H5F_OBJ_ALL);
- if ( n_objs <= 0 ) return;
-
- ids = malloc(n_objs * sizeof(hid_t));
- n_ids = H5Fget_obj_ids(fh, H5F_OBJ_ALL, n_objs, ids);
+ n_ids = H5Fget_obj_ids(fh, H5F_OBJ_ALL, 256, ids);
for ( i=0; i<n_ids; i++ ) {
hid_t id;
@@ -119,8 +115,6 @@ static void cleanup(hid_t fh)
if ( type == H5I_GROUP ) H5Gclose(id);
}
-
- free(ids);
}