failtest: Fix incorrect reuse of va_list in test/run-malloc.c.
authorAndreas Schlick <schlick@lavabit.com>
Thu, 24 Feb 2011 16:27:11 +0000 (17:27 +0100)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 1 Mar 2011 07:24:41 +0000 (17:54 +1030)
ccan/failtest/test/run-malloc.c

index 5849ef65a0277270779829c4817c905f6fe2dbb0..3912bfd060794300c8456a5ca7a3897637ddee25 100644 (file)
@@ -48,8 +48,13 @@ static char *output = NULL;
 
 static int saved_vprintf(const char *fmt, va_list ap)
 {
-       int ret = vsnprintf(NULL, 0, fmt, ap);
+       int ret;
        int len = 0;
+       va_list ap2;
+
+       va_copy(ap2, ap);
+       ret = vsnprintf(NULL, 0, fmt, ap2);
+       va_end(ap2);
 
        if (output)
                len = strlen(output);