On Mon, Sep 1, 2014 at 4:22 PM, Dave Airlie <airl...@gmail.com> wrote:
> From: Dave Airlie <airl...@redhat.com>
>
> Coverity reported this, and I think this is the right solution,
> since cache->items is struct cache_item ** not struct cache_item *,
> we also realloc it using struct cache_item * at some point.
>
> Signed-off-by: Dave Airlie <airl...@redhat.com>
> ---
>  src/mesa/program/prog_cache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/program/prog_cache.c b/src/mesa/program/prog_cache.c
> index 07192a9..34609f0 100644
> --- a/src/mesa/program/prog_cache.c
> +++ b/src/mesa/program/prog_cache.c
> @@ -143,7 +143,7 @@ _mesa_new_program_cache(void)
>     if (cache) {
>        cache->size = 17;
>        cache->items =
> -         calloc(1, cache->size * sizeof(struct cache_item));
> +         calloc(cache->size, sizeof(struct cache_item *));

git blaming that turns up a sloppy search and replace commit that
replaced _mesa_calloc(x) (taking only one argument) with calloc(1, x),
even when x was a multiplication expression.

If someone wants to fix these up: git grep 'calloc.* \* '
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to