summaryrefslogtreecommitdiffstats
path: root/test/tattr.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-08-20 21:37:12 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-08-20 21:37:12 (GMT)
commit47c3bc7540869f53f0b734c68d3289835f0a546d (patch)
tree90e688dc21b095d9d3d36e944465ac79eff05348 /test/tattr.c
parentb2012d9f74843ec87b31b7aca0c3ad8b6b6fe448 (diff)
downloadhdf5-47c3bc7540869f53f0b734c68d3289835f0a546d.zip
hdf5-47c3bc7540869f53f0b734c68d3289835f0a546d.tar.gz
hdf5-47c3bc7540869f53f0b734c68d3289835f0a546d.tar.bz2
[svn-r19272] Description:
Close out various resource leaks and usages of uninitialized memory that were flagged by valgrind. [There's still some more valgrind warnings, but it's better now... :-/ ] Also clean up warnings and code formatting. Tested on: Mac OS X/32 10.6.4 (amazon) w/debug & valgrind (h5committest forthcoming)
Diffstat (limited to 'test/tattr.c')
-rw-r--r--test/tattr.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/test/tattr.c b/test/tattr.c
index 828b8a8..60d4ddb 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -9802,6 +9802,7 @@ test_attr_bug3(hid_t fcpl, hid_t fapl)
dims2[2] = {3, 3}; /* Dimensions */
int wdata1[2][2];
unsigned wdata2[3][3]; /* Write buffers */
+ unsigned u, v; /* Local index variables */
herr_t ret; /* Generic return status */
/* Output message about test being performed */
@@ -9849,11 +9850,18 @@ test_attr_bug3(hid_t fcpl, hid_t fapl)
aid2 = H5Aopen(did, "attr", H5P_DEFAULT);
CHECK(aid2, FAIL, "H5Aopen");
- /* Write data to the attributes (the data is uninitialized, we only care
- * that H5Awrite succeeds for now) */
- ret = H5Awrite(aid1, H5T_NATIVE_INT, wdata1[0]);
+ /* Initialize the write buffers */
+ for(u = 0; u < dims1[0]; u++)
+ for(v = 0; v < dims1[1]; v++)
+ wdata1[u][v] = (int)((u * dims1[1]) + v);
+ for(u = 0; u < dims2[0]; u++)
+ for(v = 0; v < dims2[1]; v++)
+ wdata2[u][v] = (int)((u * dims2[1]) + v);
+
+ /* Write data to the attributes */
+ ret = H5Awrite(aid1, H5T_NATIVE_INT, wdata1);
CHECK(ret, FAIL, "H5Awrite");
- ret = H5Awrite(aid2, H5T_NATIVE_UINT, wdata2[0]);
+ ret = H5Awrite(aid2, H5T_NATIVE_UINT, wdata2);
CHECK(ret, FAIL, "H5Awrite");
/* Close attributes */