summaryrefslogtreecommitdiffstats
path: root/src/H5A.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-05-24 14:31:51 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-05-24 14:31:51 (GMT)
commit415889bef3df70552a389214ca2ed241aa12e379 (patch)
tree233333a5db0287e7605d96071bdd13e84bb95960 /src/H5A.c
parentc2d3d0a005275837f30515d1d2098b4a219ddc6b (diff)
downloadhdf5-415889bef3df70552a389214ca2ed241aa12e379.zip
hdf5-415889bef3df70552a389214ca2ed241aa12e379.tar.gz
hdf5-415889bef3df70552a389214ca2ed241aa12e379.tar.bz2
[svn-r13807] Description:
Fix error which attempted to allocate space for attribute that has a 'null' dataspace. Tested on: Mac OS X/32 10.4.9 (amazon) FreeBSD/32 6.2 (duty) Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5A.c')
-rw-r--r--src/H5A.c37
1 files changed, 2 insertions, 35 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 2894daf..35fdcf0 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -69,7 +69,6 @@ typedef struct H5A_iter_cb1 {
static herr_t H5A_open_common(const H5G_loc_t *loc, H5A_t *attr);
static herr_t H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id);
static herr_t H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id);
-static hsize_t H5A_get_storage_size(const H5A_t *attr);
/*********************/
@@ -1365,7 +1364,7 @@ H5Aget_storage_size(hid_t attr_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute")
/* Set return value */
- ret_value = H5A_get_storage_size(attr);
+ ret_value = attr->data_size;
done:
FUNC_LEAVE_API(ret_value)
@@ -1373,38 +1372,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A_get_storage_size
- *
- * Purpose: Private function for H5Aget_storage_size. Returns the
- * amount of storage size that is required for this
- * attribute.
- *
- * Return: Success: The amount of storage size allocated for the
- * attribute. The return value may be zero
- * if no data has been stored.
- *
- * Failure: Zero
- *
- * Programmer: Raymond Lu
- * October 23, 2002
- *
- *-------------------------------------------------------------------------
- */
-static hsize_t
-H5A_get_storage_size(const H5A_t *attr)
-{
- hsize_t ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5A_get_storage_size)
-
- /* Set return value */
- ret_value = attr->data_size;
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5A_get_storage_size() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Aget_info
*
* Purpose: Retrieve information about an attribute.
@@ -2127,7 +2094,7 @@ H5A_close(H5A_t *attr)
HDassert(attr);
/* Check if the attribute has any data yet, if not, fill with zeroes */
- if(attr->obj_opened && !attr->initialized) {
+ if(attr->obj_opened && !attr->initialized && attr->data_size) {
uint8_t *tmp_buf = H5FL_BLK_CALLOC(attr_buf, attr->data_size);
if(NULL == tmp_buf)
HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed for attribute fill-value")