]> granicus.if.org Git - gc/commitdiff
Fix vsprintf_args cleanup in CORD_vsprintf
authorIvan Maidanski <ivmai@mail.ru>
Wed, 17 Oct 2012 18:07:54 +0000 (22:07 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 18 Oct 2012 16:04:23 +0000 (20:04 +0400)
* cord/cordprnt.c (CORD_vsprintf): Invoke va_end (before return) for
vsprintf_args initialized by [__]va_copy (only if __va_copy defined
or GCC but not DJGPP).

cord/cordprnt.c

index f4c63868acce7ef30b9d8cf142d6ba6053b6bbd3..afa4300eed0d61aeeec207600598708cad87c8a3 100644 (file)
@@ -306,9 +306,17 @@ int CORD_vsprintf(CORD * out, CORD format, va_list args)
                             (void) va_arg(args, double);
                             break;
                         default:
+#                           if defined(__va_copy) \
+                               || (defined(__GNUC__) && !defined(__DJGPP__))
+                              va_end(vsprintf_args);
+#                           endif
                             return(-1);
                     }
                     res = vsprintf(buf, conv_spec, vsprintf_args);
+#                   if defined(__va_copy) \
+                       || (defined(__GNUC__) && !defined(__DJGPP__))
+                      va_end(vsprintf_args);
+#                   endif
                     len = (size_t)res;
                     if ((char *)(GC_word)res == buf) {
                         /* old style vsprintf */