From b8f7cdc48d9c8470fdf8930938e75b50210150fb Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 18 Jan 2005 21:43:04 -0500 Subject: [svn-r9837] Purpose: Bug fix Description: Calling HDvsnprintf() several times (should be twice) is incorrect without calling va_end() and va_start() again. Solution: Call va_end() and va_start() before calling HDvsnprintf() again. Platforms tested: Linux 2.4/x86_64 (mir) Too minor to require h5committest --- src/H5E.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/H5E.c b/src/H5E.c index c178e77..7b3f1c8 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -1523,7 +1523,14 @@ H5Epush_stack(hid_t err_stack, const char *file, const char *func, unsigned line /* If the description doesn't fit into the initial buffer size, allocate more space and try again */ while((desc_len=HDvsnprintf(tmp, (size_t)tmp_len, fmt, ap))>tmp_len) { + /* shutdown & restart the va_list */ + va_end(ap); + va_start(ap, fmt); + + /* Release the previous description, it's too small */ H5MM_xfree(tmp); + + /* Allocate a description of the appropriate length */ tmp_len = desc_len+1; if((tmp=H5MM_malloc((size_t)tmp_len))==NULL) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") -- cgit v0.12