On 3 September 2018 at 15:49,  <asimiklit.w...@gmail.com> wrote:
> 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."
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107810
> Signed-off-by: Andrii Simiklit <andrii.simik...@globallogic.com>
>
> ---
>  src/util/u_string.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/util/u_string.h b/src/util/u_string.h
> index ce45430..883fa64 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;

These WIN32 compat functions seem iffy.
Namely - often we'll issue a va_copy only to use the original va.

Looking through the rest of the code base:
There are plenty of va_start + util_vsnprintf + va_free cases that
could be replaced with util_snprintf.

There are also some util_vsnprintf users which use va_copy and some
who do not :-\

I think those should be looked first, otherwise adding this va_end
could easily break things.

HTH
Emil
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to