diff options
Diffstat (limited to 'src/H5E.c')
-rw-r--r-- | src/H5E.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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! :-) */ @@ -1352,6 +1353,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 */ @@ -1393,13 +1395,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); |