radv: dont call calloc when BVH is empty
Usage of pointer returned by malloc(0) is UB.
Imho this part from radv_pipeline_cache.c
is also suspicious:
static VkResult
radv_pipeline_cache_grow(struct radv_pipeline_cache *cache)
{
const uint32_t table_size = cache->table_size * 2;
const uint32_t old_table_size = cache->table_size;
const size_t byte_size = table_size * sizeof(cache->hash_table[0]);
struct cache_entry **table;
struct cache_entry **old_table = cache->hash_table;
table = malloc(byte_size);
if (table == NULL)
return vk_error(cache, VK_ERROR_OUT_OF_HOST_MEMORY);
Though I'm not sure what should be returned. (If this case can happen.)
Edited by Filip Gawin