summaryrefslogtreecommitdiffstats
path: root/test/bittests.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2011-02-08 00:53:45 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2011-02-08 00:53:45 (GMT)
commita6d5fa2c7db165fa2cecee86bdbd201339349968 (patch)
treeb7b11d751b526c91b0e0695d34c66991b80d74b3 /test/bittests.c
parent6b1297a1ba07a06acc22f76614278000896f94dd (diff)
downloadhdf5-a6d5fa2c7db165fa2cecee86bdbd201339349968.zip
hdf5-a6d5fa2c7db165fa2cecee86bdbd201339349968.tar.gz
hdf5-a6d5fa2c7db165fa2cecee86bdbd201339349968.tar.bz2
[svn-r20061] Description:
Bring changes from Coverity branch to trunk: r19930: Fix memory leaks involving VL attributes in h5repack and h5diff. The buffers in copy_attr and diff_attr were not checked for the presence of a vlen before being freed, and vlen storage was never reclaimed. Added checks and calls to H5D_vlen_reclaim(). r19933: Purpose: Fix memory leak in H5L_move_cb() Description: H5L_move_cb copied the source link using H5O_msg_copy() but freed it manually using H5MM_xfree(). Since H5O_link_copy allocates the link using H5FL_MALLOC, this causes the link to be allocated from the free list but is never put back on the free list when it is freed. This prevents the link free list from shutting down properly. Modified H5L_move_cb() and H5L_move_dest_cb() to free the link properly using H5O_msg_free(). r19973: Fix resource leaks by freeing string created by HD5f2string r19974: Issue #345: Inialize buf variable to null Tested on: Mac OS X/32 10.6.6 (amazon) w/debug & production (h5committested on Coverity branch)
Diffstat (limited to 'test/bittests.c')
-rw-r--r--test/bittests.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/test/bittests.c b/test/bittests.c
index e435d6c..f063cee 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -908,41 +908,36 @@ test_clear (void)
* Programmer: Robb Matzke
* Tuesday, June 16, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
-main (void)
+main(void)
{
- int nerrors=0;
+ int nerrors = 0;
/*
- * Open the library explicitly for thread-safe builds, so per-thread
- * things are initialized correctly.
+ * Open the library explicitly.
*/
-#ifdef H5_HAVE_THREADSAFE
H5open();
-#endif /* H5_HAVE_THREADSAFE */
-
- nerrors += test_find ()<0?1:0;
- nerrors += test_set ()<0?1:0;
- nerrors += test_clear()<0?1:0;
- nerrors += test_copy ()<0?1:0;
- nerrors += test_shift()<0?1:0;
- nerrors += test_increment ()<0?1:0;
- nerrors += test_decrement ()<0?1:0;
- nerrors += test_negate ()<0?1:0;
-
- if (nerrors) {
+
+ nerrors += test_find() < 0 ? 1 : 0;
+ nerrors += test_set() < 0 ? 1 : 0;
+ nerrors += test_clear() < 0 ? 1 : 0;
+ nerrors += test_copy() < 0 ? 1 : 0;
+ nerrors += test_shift() < 0 ? 1 : 0;
+ nerrors += test_increment() < 0 ? 1 : 0;
+ nerrors += test_decrement() < 0 ? 1 : 0;
+ nerrors += test_negate() < 0 ? 1 : 0;
+
+ if(nerrors) {
printf("***** %u FAILURE%s! *****\n",
- nerrors, 1==nerrors?"":"S");
+ nerrors, 1 == nerrors ? "" : "S");
exit(1);
}
printf("All bit tests passed.\n");
-#ifdef H5_HAVE_THREADSAFE
H5close();
-#endif /* H5_HAVE_THREADSAFE */
+
return 0;
}
+