summaryrefslogtreecommitdiffstats
path: root/test/dsets.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2012-08-08 23:01:20 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2012-08-08 23:01:20 (GMT)
commit88a94bbe7ffa3c0bb7779d1b16989b385d9eadd2 (patch)
treebe52b18015cf8df4af976ab5cfdc912748783b22 /test/dsets.c
parent79b2eb993e29cf0382db07b322fa3ca5cb00fc65 (diff)
downloadhdf5-88a94bbe7ffa3c0bb7779d1b16989b385d9eadd2.zip
hdf5-88a94bbe7ffa3c0bb7779d1b16989b385d9eadd2.tar.gz
hdf5-88a94bbe7ffa3c0bb7779d1b16989b385d9eadd2.tar.bz2
[svn-r22646] Description:
Changes resulting from Klocwork static analysis tool, from Mark Miller @ LLNL (miller86@llnl.gov). Tested on: Mac OS X/64 10.7.4 (amazon) w/debug, C++ & FORTRAN, using gcc 4.7.x (too minor to require h5committest)
Diffstat (limited to 'test/dsets.c')
-rw-r--r--test/dsets.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/test/dsets.c b/test/dsets.c
index ee341c9..3b081da 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -999,8 +999,8 @@ test_conv_buffer(hid_t fid)
herr_t status = -1;
int j, k, l;
- CmpField *cf;
- CmpFieldR *cfrR;
+ CmpField *cf = NULL;
+ CmpFieldR *cfrR = NULL;
hid_t dataset = -1; /* dataset ID */
hid_t space = -1; /* data space ID */
@@ -1014,7 +1014,7 @@ test_conv_buffer(hid_t fid)
TESTING("data type conversion buffer size");
- cf = (CmpField *)HDcalloc((size_t)1, sizeof(CmpField));
+ if ((cf = (CmpField *)HDcalloc((size_t)1, sizeof(CmpField))) == 0) goto error;
/* Populate the data members */
for(j = 0; j < DIM1; j++)
@@ -1063,7 +1063,7 @@ test_conv_buffer(hid_t fid)
if(H5Tinsert(ctype2, "C", HOFFSET(CmpFieldR, c), arr_type5) < 0) goto error;
/* Read should succeed since library will set conversion buffer big enough */
- cfrR = (CmpFieldR *)HDcalloc((size_t)1, sizeof(CmpFieldR));
+ if ((cfrR = (CmpFieldR *)HDcalloc((size_t)1, sizeof(CmpFieldR))) == 0) goto error;
if(H5Dread(dataset, ctype2, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfrR) < 0) goto error;
/* Read should fail since conversion buffer isn't big enough */
@@ -1100,10 +1100,8 @@ test_conv_buffer(hid_t fid)
if(H5Tclose(arr_type5) < 0) goto error;
if(H5Dclose(dataset) < 0) goto error;
- if(cf)
- HDfree(cf);
- if(cfrR)
- HDfree(cfrR);
+ HDfree(cf);
+ HDfree(cfrR);
puts(" PASSED");
return(0);