From: Dave Airlie Date: Mon, 1 Sep 2014 23:21:18 +0000 (+1000) Subject: mesa/program_cache: calloc the correct size for the cache. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=021e84f292ef4bb26631aec41a31c025ada1e8fd;p=mesa.git mesa/program_cache: calloc the correct size for the cache. 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 Signed-off-by: Dave Airlie --- diff --git a/src/mesa/program/prog_cache.c b/src/mesa/program/prog_cache.c index 07192a96abf..34609f05696 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 *)); if (!cache->items) { free(cache); return NULL;