Make a copy of the va_list as vsnprintf() is free to change it.
authorPierre Ossman <ossman@cendio.se>
Tue, 13 Jun 2006 15:54:11 +0000 (15:54 +0000)
committerPierre Ossman <ossman@cendio.se>
Tue, 13 Jun 2006 15:54:11 +0000 (15:54 +0000)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1017 fefdeb5f-60dc-0310-8127-8f9354f1896f

src/polypcore/core-util.c

index 6cf281c..dfa41f5 100644 (file)
@@ -366,8 +366,14 @@ char *pa_vsprintf_malloc(const char *format, va_list ap) {
     
     for(;;) {
         int r;
+        va_list aq;
+
+        va_copy(aq, ap);
+
         c = pa_xrealloc(c, size);
-        r = vsnprintf(c, size, format, ap);
+        r = vsnprintf(c, size, format, aq);
+
+        va_end(aq);
         
         if (r > -1 && r < size)
             return c;