util: add assert that key cannot be NULL on insertion
authorTapani Pälli <tapani.palli@intel.com>
Fri, 19 Aug 2016 11:33:13 +0000 (14:33 +0300)
committerTapani Pälli <tapani.palli@intel.com>
Mon, 22 Aug 2016 04:37:55 +0000 (07:37 +0300)
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/util/hash_table.c

index 4cfe3d93251fe799dc697c2db9a100f82c00d530..9e643af8b239a19c84472d1fb5dbe4cdba89729b 100644 (file)
@@ -295,6 +295,8 @@ hash_table_insert(struct hash_table *ht, uint32_t hash,
    uint32_t start_hash_address, hash_address;
    struct hash_entry *available_entry = NULL;
 
+   assert(key != NULL);
+
    if (ht->entries >= ht->max_entries) {
       _mesa_hash_table_rehash(ht, ht->size_index + 1);
    } else if (ht->deleted_entries + ht->entries >= ht->max_entries) {