diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2012-08-09 01:02:02 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2012-08-09 01:02:02 (GMT) |
commit | 4e6b652c3d0fdd94fc7f2aa588ab63cea7bcde64 (patch) | |
tree | 067a2194a69b6f5334310528b1650c131971c861 /test/dsets.c | |
parent | 98ac51ba1c4b73081ab0a3091f3cca703426b593 (diff) | |
download | hdf5-4e6b652c3d0fdd94fc7f2aa588ab63cea7bcde64.zip hdf5-4e6b652c3d0fdd94fc7f2aa588ab63cea7bcde64.tar.gz hdf5-4e6b652c3d0fdd94fc7f2aa588ab63cea7bcde64.tar.bz2 |
[svn-r22647] Description:
Bring r22646 from trunk to 1.8 branch:
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.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/test/dsets.c b/test/dsets.c index 043c44a..3b0d25d 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1004,8 +1004,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 */ @@ -1019,7 +1019,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++) @@ -1068,7 +1068,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 */ @@ -1105,10 +1105,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); |