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 <tapani.palli@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
a75fee78c6
commit
021e84f292
|
@ -143,7 +143,7 @@ _mesa_new_program_cache(void)
|
||||||
if (cache) {
|
if (cache) {
|
||||||
cache->size = 17;
|
cache->size = 17;
|
||||||
cache->items =
|
cache->items =
|
||||||
calloc(1, cache->size * sizeof(struct cache_item));
|
calloc(cache->size, sizeof(struct cache_item *));
|
||||||
if (!cache->items) {
|
if (!cache->items) {
|
||||||
free(cache);
|
free(cache);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue