mesa/program_cache: calloc the correct size for the cache.
authorDave Airlie <airlied@redhat.com>
Mon, 1 Sep 2014 23:21:18 +0000 (09:21 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 2 Sep 2014 06:42:24 +0000 (16:42 +1000)
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.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/program/prog_cache.c

index 07192a96abf95b6a6fa1aba67fd2b6d48a60c763..34609f05696a6a26f6cb642f7f74cc1a5d9b63ab 100644 (file)
@@ -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 *));
       if (!cache->items) {
          free(cache);
          return NULL;