[Mesa-dev] [PATCH] u_dynarray: fix coverity warning about ignoring return value from reralloc

Thomas Helland thomashelland90 at gmail.com
Mon Jun 12 20:36:43 UTC 2017


Reviewed-by: Thomas Helland<thomashelland90 at gmail.com>

On Jun 12, 2017 21:50, "Dave Airlie" <airlied at gmail.com> wrote:

> From: Dave Airlie <airlied at redhat.com>
>
> >>>     Ignoring storage allocated by "reralloc_size(buf->mem_ctx,
> buf->data, buf->size)" leaks it.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/util/u_dynarray.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/util/u_dynarray.h b/src/util/u_dynarray.h
> index e9109cc..fdcd09c 100644
> --- a/src/util/u_dynarray.h
> +++ b/src/util/u_dynarray.h
> @@ -107,7 +107,7 @@ util_dynarray_trim(struct util_dynarray *buf)
>     if (buf->size != buf->capacity) {
>        if (buf->size) {
>           if (buf->mem_ctx) {
> -            reralloc_size(buf->mem_ctx, buf->data, buf->size);
> +            buf->data = reralloc_size(buf->mem_ctx, buf->data, buf->size);
>           } else {
>              buf->data = realloc(buf->data, buf->size);
>           }
> --
> 2.9.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170612/f931af98/attachment.html>


More information about the mesa-dev mailing list