diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-12-10 18:34:53 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-12-10 18:34:53 (GMT) |
commit | f473fc5cb8a6e100141088568533e9973ad5d95e (patch) | |
tree | 41be442740674a3323244614f46fb5b77c77984b /src/H5S.c | |
parent | 404567ce6466d3cf04743f2dc1cdf15568b01a5d (diff) | |
download | hdf5-f473fc5cb8a6e100141088568533e9973ad5d95e.zip hdf5-f473fc5cb8a6e100141088568533e9973ad5d95e.tar.gz hdf5-f473fc5cb8a6e100141088568533e9973ad5d95e.tar.bz2 |
[svn-r7926] Purpose:
Bug fix
Description:
Clean up a few allocations of zero-sized blocks that were detected with
the new free-list assertions.
Platforms tested:
FreeBSD 4.9 (sleipnir) w & w/o parallel
too minor to require h5committest
Diffstat (limited to 'src/H5S.c')
-rw-r--r-- | src/H5S.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -1200,8 +1200,12 @@ H5S_read(H5G_entry_t *ent, hid_t dxpl_id) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); /* Allocate space for the offset and set it to zeros */ - if (NULL==(ds->select.offset = H5FL_ARR_CALLOC(hssize_t,ds->extent.u.simple.rank))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if(ds->extent.u.simple.rank>0) { + if (NULL==(ds->select.offset = H5FL_ARR_CALLOC(hssize_t,ds->extent.u.simple.rank))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + } /* end if */ + else + ds->select.offset = NULL; /* Set the value for successful return */ ret_value=ds; @@ -1380,8 +1384,12 @@ H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims, space->select.offset=H5FL_ARR_FREE(hssize_t,space->select.offset); /* Allocate space for the offset and set it to zeros */ - if (NULL==(space->select.offset = H5FL_ARR_CALLOC(hssize_t,rank))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + if(rank>0) { + if (NULL==(space->select.offset = H5FL_ARR_CALLOC(hssize_t,rank))) + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + } /* end if */ + else + space->select.offset = NULL; /* shift out of the previous state to a "simple" dataspace */ switch (space->extent.type) { @@ -1917,6 +1925,8 @@ H5Soffset_simple(hid_t space_id, const hssize_t *offset) /* Check args */ if (NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); + if (space->extent.u.simple.rank==0 || space->extent.type==H5S_SCALAR) + HGOTO_ERROR(H5E_ATOM, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar dataspace"); if (offset == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no offset specified"); |