summaryrefslogtreecommitdiffstats
path: root/hl/src
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2005-03-25 15:07:06 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2005-03-25 15:07:06 (GMT)
commitfed2ef094f85b3063b9fc9e6d9c8462e60a9ad3a (patch)
tree48a03cc35cf5e72755061bd52a9f0f2a1b8bcfba /hl/src
parent6e69e26376e5bb4d08329be9686163563908c833 (diff)
downloadhdf5-fed2ef094f85b3063b9fc9e6d9c8462e60a9ad3a.zip
hdf5-fed2ef094f85b3063b9fc9e6d9c8462e60a9ad3a.tar.gz
hdf5-fed2ef094f85b3063b9fc9e6d9c8462e60a9ad3a.tar.bz2
[svn-r10416] Purpose:
bug fix Description: when exiting due to a error condition on the goto out instruction there was an attempt to call H5Dvlen_reclaim without checking if buf was null Solution: checket it Platforms tested: linux solaris IRIX64 AIX Misc. update:
Diffstat (limited to 'hl/src')
-rw-r--r--hl/src/H5DS.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index 891bff3..fbff253 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -179,7 +179,7 @@ herr_t H5DSattach_scale(hid_t did,
/* get dataset space */
if ((sid = H5Dget_space(did))<0)
- goto out;
+ return FAIL;
/* get rank */
if ((rank=H5Sget_simple_extent_ndims(sid))<0)
@@ -187,11 +187,11 @@ herr_t H5DSattach_scale(hid_t did,
/* close dataset space */
if (H5Sclose(sid)<0)
- goto out;
+ return FAIL;
/* parameter range checking */
if (idx>(unsigned)rank-1)
- goto out;
+ return FAIL;
/*-------------------------------------------------------------------------
* two references are created: one to the DS, saved in "DIMENSION_LIST"
@@ -200,11 +200,11 @@ herr_t H5DSattach_scale(hid_t did,
*/
/* create a reference for the >>DS<< dataset */
if (H5Rcreate(&ref_to_ds,dsid,".",H5R_OBJECT,-1)<0)
- goto out;
+ return FAIL;
/* create a reference for the >>data<< dataset */
if (H5Rcreate(&dsl.ref,did,".",H5R_OBJECT,-1)<0)
- goto out;
+ return FAIL;
/* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */
if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST))<0)
@@ -220,13 +220,13 @@ herr_t H5DSattach_scale(hid_t did,
dims = (hsize_t*) malloc (1 * sizeof (hsize_t));
if (dims == NULL)
- goto out;
+ return FAIL;
dims[0] = rank;
/* space for the attribute */
if ((sid = H5Screate_simple(1,dims,NULL))<0)
- goto out;
+ return FAIL;
/* create the type for the attribute "DIMENSION_LIST" */
if ((tid = H5Tvlen_create(H5T_STD_REF_OBJ))<0)
@@ -617,14 +617,14 @@ herr_t H5DSdetach_scale(hid_t did,
*/
/* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */
if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST))<0)
- goto out;
+ return FAIL;
if (has_dimlist == 0)
- goto out;
+ return FAIL;
/* get dataset space */
if ((sid = H5Dget_space(did))<0)
- goto out;
+ return FAIL;
/* get rank */
if ((rank=H5Sget_simple_extent_ndims(sid))<0)
@@ -632,7 +632,7 @@ herr_t H5DSdetach_scale(hid_t did,
/* close dataset space */
if (H5Sclose(sid)<0)
- goto out;
+ return FAIL;
/*-------------------------------------------------------------------------
@@ -642,10 +642,10 @@ herr_t H5DSdetach_scale(hid_t did,
/* try to find the attribute "REFERENCE_LIST" on the >>DS<< dataset */
if ((has_reflist = H5LT_find_attribute(dsid,REFERENCE_LIST))<0)
- goto out;
+ return FAIL;
if (has_reflist == 0)
- goto out;
+ return FAIL;
/*-------------------------------------------------------------------------
* open "DIMENSION_LIST", and delete the reference
@@ -653,7 +653,7 @@ herr_t H5DSdetach_scale(hid_t did,
*/
if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0)
- goto out;
+ return FAIL;
if ((tid = H5Aget_type(aid))<0)
goto out;
@@ -927,7 +927,7 @@ int H5DSget_num_scales(hid_t did,
int rank; /* rank of dataset */
hvl_t *buf; /* VL buffer to store in the attribute */
H5I_type_t it; /* ID type */
- int nscales;
+ int nscales;
/*-------------------------------------------------------------------------
* parameter checking
@@ -946,7 +946,7 @@ int H5DSget_num_scales(hid_t did,
*/
/* get dataset space */
if ((sid = H5Dget_space(did))<0)
- goto out;
+ return FAIL;
/* get rank */
if ((rank=H5Sget_simple_extent_ndims(sid))<0)
@@ -958,7 +958,7 @@ int H5DSget_num_scales(hid_t did,
/* DIM range checking */
if (dim>=(unsigned int )rank)
- goto out;
+ return FAIL;
/* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */
if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST))<0)
@@ -966,7 +966,7 @@ int H5DSget_num_scales(hid_t did,
/* it does not exist */
if (has_dimlist == 0)
- goto out;
+ return FAIL;
/*-------------------------------------------------------------------------
* the attribute exists, open it
@@ -1075,7 +1075,7 @@ herr_t H5DSset_label(hid_t did,
/* get dataset space */
if ((sid = H5Dget_space(did))<0)
- goto out;
+ return FAIL;
/* get rank */
if ((rank=H5Sget_simple_extent_ndims(sid))<0)
@@ -1252,7 +1252,7 @@ ssize_t H5DSget_label(hid_t did,
/* get dataset space */
if ((sid = H5Dget_space(did))<0)
- goto out;
+ return FAIL;
/* get rank */
if ((rank=H5Sget_simple_extent_ndims(sid))<0)
@@ -1491,7 +1491,6 @@ htri_t H5DSis_scale(hid_t did)
if (H5I_DATASET!=it)
return FAIL;
-
/* try to find the attribute "CLASS" on the dataset */
if ((has_class = H5LT_find_attribute(did,"CLASS"))<0)
return FAIL;
@@ -1611,11 +1610,11 @@ herr_t H5DSiterate_scales(hid_t did,
/* get the number of scales assotiated with this DIM */
if ((nscales = H5DSget_num_scales(did,dim))<0)
- goto out;
+ return FAIL;
/* get dataset space */
if ((sid = H5Dget_space(did))<0)
- goto out;
+ return FAIL;
/* get rank */
if ((rank=H5Sget_simple_extent_ndims(sid))<0)
@@ -1627,7 +1626,7 @@ herr_t H5DSiterate_scales(hid_t did,
/* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */
if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST))<0)
- goto out;
+ return FAIL;
if (has_dimlist == 0)
return SUCCESS;
@@ -1711,13 +1710,15 @@ herr_t H5DSiterate_scales(hid_t did,
out:
H5E_BEGIN_TRY {
- H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf);
+ if (buf)
+ {
+ H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf);
+ free(buf);
+ }
H5Sclose(sid);
H5Aclose(aid);
H5Tclose(tid);
} H5E_END_TRY;
- if (buf)
- free(buf);
return FAIL;
}
@@ -1801,7 +1802,7 @@ htri_t H5DSis_attached(hid_t did,
/* get dataset space */
if ((sid = H5Dget_space(did))<0)
- goto out;
+ return FAIL;
/* get rank */
if ((rank=H5Sget_simple_extent_ndims(sid))<0)