summaryrefslogtreecommitdiffstats
path: root/src/H5.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2011-04-17 19:16:38 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2011-04-17 19:16:38 (GMT)
commit0badac6423ddfeb881345838e3879ad413e52ad1 (patch)
tree0ad085535930a65392a00ee911579574d24008a0 /src/H5.c
parenta99c68f3f9ac16df25d68a06947d92fcd0da220c (diff)
downloadhdf5-0badac6423ddfeb881345838e3879ad413e52ad1.zip
hdf5-0badac6423ddfeb881345838e3879ad413e52ad1.tar.gz
hdf5-0badac6423ddfeb881345838e3879ad413e52ad1.tar.bz2
[svn-r20537] Description:
Bring r20535 & r20536 from trunk to 1.8 branch: Add explicit test that checks that the 'fileno' field in H5O_info_t is the same for objects in the same file, whether the file was opened twice or not. Clean up various warnings & code formatting issues. Bring changes from Coverity branch to trunk: r20085: Purpose: Fix coverity issue 793 Description: Modified H5S_hyper_project_simple_higher() to free the entire span list in new_space on failure. r20091: This is a fix for coverity bug #1683. Changed the two printfs to use %lu (unsigned long) for printing "dset_size". r20162: Purpose: Fix coverity issue 785 Description: Modified H5T_enum_nameof() to free "name" on failure if it was allocated. Also clarified some code in H5S_hyper_rebuild_helper(). r20189: Addressed coverity defect 783. H5SL_new_node() in H5SL.c was failing to free space allocated in its first alloc if the second alloc failed. Added a call to H5FL_FREE to address this issue. This is purely to keep coverity happy -- if this code is ever triggered, we have much larger problems. Note that this fix will trigger an unused return value complaint from coverity next week. r20190: Fixed Coverity issues 1561 1565 and 1678 (UNUSED_VALUES) by moving checks of return values to after the function call. r20191: Fixed coverity issues 643 644 and 1678 (CHECKED_RETURN). r20232: Addressed coverity issues 923-925. Replaced calls to sprintf with calls to HDsnprintf. r20233: Fix coverity issue 662. Don't try to sort 0 attributes in H5Aint.c. r20234: Fix coverity issue 664. Check for NULL before dereferencing in H5Gdeprec.c. r20271: Purpose: Fix coverity issue 784 Description: Modified H5_debug_mask() to keep a list of files opened for use as a debugging output stream, and modified H5_term_library to close these files on exit. r20272: addressed coverity issues 838 & 955. Issue was use of strcpy() -- existing code was safe, but modified to use strncpy() to keep coverity happy. r20273: Addresed coverity issues 1388 and 1389. Initialized sel_iter->type to NULL in H5S_select_iter_init. r20275: Purpose: Fix valgrind issue in mf.c Description: Fixed bug (incomplete if statement) in test_mf_fs_alloc_free() so the retrieved node gets freed. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Diffstat (limited to 'src/H5.c')
-rw-r--r--src/H5.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/H5.c b/src/H5.c
index 045c65b..b6ad4e4 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -27,6 +27,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free lists */
#include "H5Lprivate.h" /* Links */
+#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
#include "H5Tprivate.h" /* Datatypes */
#include "H5SLprivate.h" /* Skip lists */
@@ -309,6 +310,16 @@ H5_term_library(void)
} /* end if */
#endif
+ /* Free open debugging streams */
+ while(H5_debug_g.open_stream) {
+ H5_debug_open_stream_t *tmp_open_stream;
+
+ tmp_open_stream = H5_debug_g.open_stream;
+ (void)HDfclose(H5_debug_g.open_stream->stream);
+ H5_debug_g.open_stream = H5_debug_g.open_stream->next;
+ (void)H5MM_free(tmp_open_stream);
+ } /* end while */
+
/* Mark library as closed */
H5_INIT_GLOBAL = FALSE;
done:
@@ -532,9 +543,21 @@ H5_debug_mask(const char *s)
}
} else if (HDisdigit(*s)) {
- int fd = (int)HDstrtol (s, &rest, 0);
- if ((stream=HDfdopen(fd, "w"))!=NULL)
- (void)HDsetvbuf (stream, NULL, _IOLBF, (size_t)0);
+ int fd = (int)HDstrtol(s, &rest, 0);
+ H5_debug_open_stream_t *open_stream;
+
+ if((stream = HDfdopen(fd, "w")) != NULL) {
+ (void)HDsetvbuf(stream, NULL, _IOLBF, (size_t)0);
+
+ if(NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) {
+ (void)HDfclose(stream);
+ return;
+ } /* end if */
+
+ open_stream->stream = stream;
+ open_stream->next = H5_debug_g.open_stream;
+ H5_debug_g.open_stream = open_stream;
+ } /* end if */
s = rest;
} else {
s++;