summaryrefslogtreecommitdiff
path: root/src/mesa/shader/program_parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/shader/program_parse.y')
-rw-r--r--src/mesa/shader/program_parse.y9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y
index d5fb0fac3e..06c2db7a07 100644
--- a/src/mesa/shader/program_parse.y
+++ b/src/mesa/shader/program_parse.y
@@ -2596,24 +2596,25 @@ make_error_string(const char *fmt, ...)
char *str;
va_list args;
- va_start(args, fmt);
/* Call vsnprintf once to determine how large the final string is. Call it
- * again to do the actual formatting. from the v_mesa_snprintf manual page:
+ * again to do the actual formatting. from the vsnprintf manual page:
*
* Upon successful return, these functions return the number of
* characters printed (not including the trailing '\0' used to end
* output to strings).
*/
+ va_start(args, fmt);
length = 1 + vsnprintf(NULL, 0, fmt, args);
+ va_end(args);
str = malloc(length);
if (str) {
+ va_start(args, fmt);
vsnprintf(str, length, fmt, args);
+ va_end(args);
}
- va_end(args);
-
return str;
}