diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-03-06 21:24:31 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-03-06 21:24:31 (GMT) |
commit | 9211b9e5b6f158310ffbe0942a3d254ccafc9693 (patch) | |
tree | c0b6ac392ec67d3394d36898de7d66e81ebbd621 /test/dsets.c | |
parent | 8b3a2b480b412ebb04997d57343fc0733906afe6 (diff) | |
download | hdf5-9211b9e5b6f158310ffbe0942a3d254ccafc9693.zip hdf5-9211b9e5b6f158310ffbe0942a3d254ccafc9693.tar.gz hdf5-9211b9e5b6f158310ffbe0942a3d254ccafc9693.tar.bz2 |
[svn-r18389] Description:
Bring r18388 from trunk back to 1.8 branch:
Bring changes from Coverity session from branch into trunk:
r18378:
Fixed coverity issues 207 and 322. Pointer hdr was checked for NULL after being
asserted and dereferenced. Check was removed.
r18379:
Fix coverity issues # 88 and # 435.
r18380:
Fixed Coverity issue # 85. Added check of returned pointer for NULL before use.
r18381:
Resolve coverity issues # 214 and # 215
r18382:
Issue 131: Add null checks to allocations and check for free in error handling
r18383:
Issue 421:
Reorganized code to make intention clearer. Also, set local variable fl to NULL
after transfer to tail. Heap->freelist will take care of all allocations
r18384:
Coverity #249 and #250 - STRING_ATT_CHECK wasn't allocated before being used
and freed in function test_write_vl_string_attribute and
test_read_vl_string_attribute.
Tested on:
Mac OS X/32 10.6.2 (amazon) w/debug & prod
(h5committested in daily tests)
Diffstat (limited to 'test/dsets.c')
-rw-r--r-- | test/dsets.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/dsets.c b/test/dsets.c index b484365..f430897 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1279,8 +1279,6 @@ const H5Z_class2_t H5Z_CORRUPT[1] = {{ * Programmer: Raymond Lu * Jan 14, 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static size_t @@ -1288,7 +1286,7 @@ filter_corrupt(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf) { - void *data; + void *data = NULL; unsigned char *dst = (unsigned char*)(*buf); unsigned int offset; unsigned int length; @@ -1296,20 +1294,21 @@ filter_corrupt(unsigned int flags, size_t cd_nelmts, size_t ret_value = 0; if(cd_nelmts != 3 || !cd_values) - return 0; + TEST_ERROR offset = cd_values[0]; length = cd_values[1]; value = cd_values[2]; if(offset > nbytes || (offset + length) > nbytes || length < sizeof(unsigned int)) - return 0; + TEST_ERROR - data = HDmalloc((size_t)length); + if(NULL == (data = HDmalloc((size_t)length))) + TEST_ERROR HDmemset(data, (int)value, (size_t)length); if(flags & H5Z_FLAG_REVERSE) { /* Varify data is actually corrupted during read */ dst += offset; if(HDmemcmp(data, dst, (size_t)length) != 0) - ret_value = 0; + TEST_ERROR else { *buf_size = nbytes; ret_value = nbytes; @@ -1322,11 +1321,12 @@ filter_corrupt(unsigned int flags, size_t cd_nelmts, ret_value = *buf_size; } /* end else */ +error: if(data) HDfree(data); return ret_value; -} +} /* end filter_corrupt() */ /*------------------------------------------------------------------------- |