]> git.ozlabs.org Git - ccan/blobdiff - ccan/failtest/test/run-malloc.c
failtest: Fix incorrect reuse of va_list in test/run-malloc.c.
[ccan] / 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);