summaryrefslogtreecommitdiffstats
path: root/src/H5.c
diff options
context:
space:
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 0a14c6e..72e0a1b 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 */
@@ -313,6 +314,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:
@@ -536,9 +547,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++;