mesa/util: don't use the same 'va_list' instance twice
authorAndrii Simiklit <andrii.simiklit@globallogic.com>
Thu, 6 Sep 2018 14:43:52 +0000 (17:43 +0300)
committerEric Engestrom <eric.engestrom@intel.com>
Thu, 6 Sep 2018 16:33:27 +0000 (17:33 +0100)
The first usage of the 'va_list' instance could change it.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Fixes: 864148d69e1e "util: add util_vasprintf() for Windows (v2)"
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
src/util/u_string.h

index ce454308d7b293c650ac01ac3878a42dfc511a36..374c00e0bcb9302cb11b629bcb3beae36fc7a39a 100644 (file)
@@ -119,7 +119,7 @@ util_vasprintf(char **ret, const char *format, va_list ap)
 
    /* Compute length of output string first */
    va_copy(ap_copy, ap);
-   int r = util_vsnprintf(NULL, 0, format, ap);
+   int r = util_vsnprintf(NULL, 0, format, ap_copy);
    va_end(ap_copy);
 
    if (r < 0)