>From 8a3e16a6f6aad8f886c35b438a4493d94141d545 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov@codeweavers.com>
Date: Sat, 18 Feb 2012 14:06:36 +0300
Subject: [PATCH 1/1] Properly use va_start/va_end around vsnprintf()

---
 libs/wpp/ppl.l |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libs/wpp/ppl.l b/libs/wpp/ppl.l
index 98f3e1a..2718fd0 100644
--- a/libs/wpp/ppl.l
+++ b/libs/wpp/ppl.l
@@ -329,6 +329,7 @@ void pp_writestring(const char *format, ...)
 	va_start(valist, format);
 	len = vsnprintf(buffer, buffercapacity,
 			format, valist);
+	va_end(valist);
         /* If the string is longer than buffersize, vsnprintf returns
          * the string length with glibc >= 2.1, -1 with glibc < 2.1 */
 	while(len > buffercapacity || len < 0)
@@ -345,10 +346,11 @@ void pp_writestring(const char *format, ...)
 			return;
 		}
 		buffer = new_buffer;
+		va_start(valist, format);
 		len = vsnprintf(buffer, buffercapacity,
 				format, valist);
+		va_end(valist);
 	}
-	va_end(valist);
 
 	wpp_callbacks->write(buffer, len);
 }
-- 
1.5.6.5

