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

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Jun 12 20:03:06 UTC 2017


Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

On 06/12/2017 09:50 PM, Dave Airlie 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);
>            }
> 


More information about the mesa-dev mailing list