From: Andrii Simiklit <andrii.simik...@globallogic.com> MSDN: "va_end must be called on each argument list that's initialized with va_start or va_copy before the function returns."
v2: Linux man about vXXXprintf functions: "These functions do not call the va_end macro. Because they invoke the va_arg macro, the value of ap is undefined after the call" So we should have instance copy of va_list for each 'vXXXprintf' call. Signed-off-by: Andrii Simiklit <andrii.simik...@globallogic.com> --- src/util/u_string.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/u_string.h b/src/util/u_string.h index ce45430..2bccb10 100644 --- a/src/util/u_string.h +++ b/src/util/u_string.h @@ -81,6 +81,7 @@ util_vsnprintf(char *str, size_t size, const char *format, va_list ap) if (ret < 0) { ret = _vscprintf(format, ap_copy); } + va_end(ap_copy); return ret; } @@ -119,7 +120,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) -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev