summaryrefslogtreecommitdiffstats
path: root/src/H5E.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5E.c')
-rw-r--r--src/H5E.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/H5E.c b/src/H5E.c
index 7a81d32..af78f26 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -1333,6 +1333,7 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line,
int desc_len; /* Actual length of description when formatted */
#endif /* H5_HAVE_VASPRINTF */
char *tmp = NULL; /* Buffer to place formatted description in */
+ hbool_t va_started = FALSE; /* Whether the variable argument list is open */
herr_t ret_value=SUCCEED; /* Return value */
/* Don't clear the error stack! :-) */
@@ -1357,6 +1358,7 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line,
/* Format the description */
va_start(ap, fmt);
+ va_started = TRUE;
#ifdef H5_HAVE_VASPRINTF
/* Use the vasprintf() routine, since it does what we're trying to do below */
@@ -1398,13 +1400,13 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line,
} /* end while */
#endif /* H5_HAVE_VASPRINTF */
- va_end(ap);
-
/* Push the error on the stack */
if(H5E_push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack")
done:
+ if(va_started)
+ va_end(ap);
if(tmp)
H5MM_xfree(tmp);