summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2005-01-19 02:43:04 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2005-01-19 02:43:04 (GMT)
commitb8f7cdc48d9c8470fdf8930938e75b50210150fb (patch)
tree03f7b7293c6ceb63894a492e663ff6192f73b236
parent7b10edb1210768d6a3c86b5c3cd66d9aabc21bb1 (diff)
downloadhdf5-b8f7cdc48d9c8470fdf8930938e75b50210150fb.zip
hdf5-b8f7cdc48d9c8470fdf8930938e75b50210150fb.tar.gz
hdf5-b8f7cdc48d9c8470fdf8930938e75b50210150fb.tar.bz2
[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
-rw-r--r--src/H5E.c7
1 files changed, 7 insertions, 0 deletions
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")