From: Ivan Maidanski Date: Wed, 17 Oct 2012 18:07:54 +0000 (+0400) Subject: Fix vsprintf_args cleanup in CORD_vsprintf X-Git-Tag: gc7_2e~59 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5d8e6aa3b39e8e9c1e11d00a66069b7da48b1841;p=gc Fix vsprintf_args cleanup in CORD_vsprintf * 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). --- diff --git a/cord/cordprnt.c b/cord/cordprnt.c index f4c63868..afa4300e 100644 --- a/cord/cordprnt.c +++ b/cord/cordprnt.c @@ -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 */