summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-08-25 21:08:49 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-08-25 21:08:49 (GMT)
commitddcae21908080ffbd40fcd5ce3244df5f391e02d (patch)
treeb4a6b336e60f8131c9eb4d03a0d534ece4744f25 /test
parent02a65c468589eee54e3a4e6a851303792fe9a87d (diff)
downloadhdf5-ddcae21908080ffbd40fcd5ce3244df5f391e02d.zip
hdf5-ddcae21908080ffbd40fcd5ce3244df5f391e02d.tar.gz
hdf5-ddcae21908080ffbd40fcd5ce3244df5f391e02d.tar.bz2
[svn-r19298] Description:
Bring r19297 from trunk to 1.8 branch: Whack a few more memory errors exposed by valgrind. Make the debugging dump output a little bit prettier. Tested on: FreeBSD/32 6.3 (duty) w/debug (h5committested on trunk)
Diffstat (limited to 'test')
-rw-r--r--test/dtransform.c2
-rw-r--r--test/enum.c2
-rw-r--r--test/freespace.c63
-rw-r--r--test/set_extent.c4
4 files changed, 65 insertions, 6 deletions
diff --git a/test/dtransform.c b/test/dtransform.c
index 9af1dfb..5d5cefe 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -616,7 +616,7 @@ test_getset(const hid_t dxpl_id_c_to_f)
TESTING("H5Pget_data_transform, after resetting transform property")
- if(NULL == (ptrgetTest = (char *)HDcalloc(1, HDstrlen(simple) + 1)))
+ if(NULL == (ptrgetTest = (char *)HDcalloc((size_t)1, HDstrlen(simple) + 1)))
TEST_ERROR
if(H5Pget_data_transform(dxpl_id_c_to_f, ptrgetTest, HDstrlen(simple) + 1) < 0)
TEST_ERROR
diff --git a/test/enum.c b/test/enum.c
index 4599a7c..c627af1 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -71,7 +71,7 @@ test_named(hid_t file)
if(H5Tclose(type) < 0) FAIL_STACK_ERROR
/* A smaller type */
- if((type = H5Tcreate(H5T_ENUM, 1)) < 0) FAIL_STACK_ERROR
+ if((type = H5Tcreate(H5T_ENUM, (size_t)1)) < 0) FAIL_STACK_ERROR
if(H5Tenum_insert(type, "RED", CPTR(val8, E1_RED )) < 0) FAIL_STACK_ERROR
if(H5Tenum_insert(type, "GREEN", CPTR(val8, E1_GREEN)) < 0) FAIL_STACK_ERROR
if(H5Tenum_insert(type, "BLUE", CPTR(val8, E1_BLUE )) < 0) FAIL_STACK_ERROR
diff --git a/test/freespace.c b/test/freespace.c
index 0f6514c..b4a774f 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -593,7 +593,7 @@ test_fs_sect_add(hid_t fapl)
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
- TEST_free_section_t *sect_node;
+ TEST_free_section_t *sect_node = NULL;
unsigned init_flags=0;
h5_stat_size_t file_size=0, tmp_file_size=0, fr_meta_size=0;
unsigned can_shrink=FALSE;
@@ -858,6 +858,11 @@ test_fs_sect_add(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node) < 0)
+ TEST_ERROR
+ sect_node = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -878,6 +883,8 @@ test_fs_sect_add(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(sect_node)
+ TEST_sect_free((H5FS_section_info_t *)sect_node);
if(frsp)
H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
H5Fclose(file);
@@ -918,7 +925,7 @@ test_fs_sect_find(hid_t fapl)
H5FS_create_t cparam; /* creation parameters */
frspace_state_t state; /* State of free space*/
- TEST_free_section_t *sect_node1, *sect_node2, *sect_node3, *sect_node4;
+ TEST_free_section_t *sect_node1 = NULL, *sect_node2, *sect_node3 = NULL, *sect_node4 = NULL;
TEST_free_section_t *node;
htri_t node_found = FALSE;
unsigned init_flags=0;
@@ -1077,6 +1084,17 @@ test_fs_sect_find(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node4) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ sect_node1 = NULL;
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node3) < 0)
+ TEST_ERROR
+ sect_node3 = NULL;
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node4) < 0)
+ TEST_ERROR
+ sect_node4 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -1145,11 +1163,17 @@ test_fs_sect_find(hid_t fapl)
if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
TEST_ERROR
+ node = NULL;
/* remove sections A */
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ sect_node1 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -1199,6 +1223,11 @@ test_fs_sect_find(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ sect_node1 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -1219,6 +1248,12 @@ test_fs_sect_find(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(sect_node1)
+ TEST_sect_free((H5FS_section_info_t *)sect_node1);
+ if(sect_node3)
+ TEST_sect_free((H5FS_section_info_t *)sect_node3);
+ if(sect_node4)
+ TEST_sect_free((H5FS_section_info_t *)sect_node4);
if(frsp)
H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
H5Fclose(file);
@@ -1484,6 +1519,12 @@ test_fs_sect_merge(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node2) < 0)
+ TEST_ERROR
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -1672,6 +1713,10 @@ test_fs_sect_merge(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(sect_node1)
+ TEST_sect_free((H5FS_section_info_t *)sect_node1);
+ if(sect_node2)
+ TEST_sect_free((H5FS_section_info_t *)sect_node2);
if(frsp)
H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
H5Fclose(file);
@@ -2152,6 +2197,11 @@ test_fs_sect_change_class(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node2) < 0)
+ TEST_ERROR
+ sect_node2 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -2269,6 +2319,11 @@ test_fs_sect_change_class(hid_t fapl)
if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
+ /* Free the section node(s) */
+ if(TEST_sect_free((H5FS_section_info_t *)sect_node1) < 0)
+ TEST_ERROR
+ sect_node1 = NULL;
+
/* Close the free space manager */
if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0)
FAIL_STACK_ERROR
@@ -2289,6 +2344,10 @@ test_fs_sect_change_class(hid_t fapl)
error:
H5E_BEGIN_TRY {
+ if(sect_node1)
+ TEST_sect_free((H5FS_section_info_t *)sect_node1);
+ if(sect_node2)
+ TEST_sect_free((H5FS_section_info_t *)sect_node2);
if(frsp)
H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp);
H5Fclose(file);
diff --git a/test/set_extent.c b/test/set_extent.c
index 0582c41..191962d 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -130,10 +130,10 @@ int main( void )
if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
/* Set chunk cache so only part of the chunks can be cached on fapl */
- if(H5Pset_cache(fapl, 0, 8, 256 * sizeof(int), 0.75) < 0) TEST_ERROR
+ if(H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75) < 0) TEST_ERROR
/* Disable chunk caching on fapl2 */
- if(H5Pset_cache(fapl2, 0, 0, 0, 0.) < 0) TEST_ERROR
+ if(H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.) < 0) TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR