mesa: add missing null check in _mesa_NewHashTable()

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Juha-Pekka Heikkila
2014-02-26 14:03:19 +02:00
committed by Tapani Pälli
parent 85b6f36ca5
commit 77a00c71bb
+10
View File
@@ -115,10 +115,20 @@ _mesa_NewHashTable(void)
if (table) {
table->ht = _mesa_hash_table_create(NULL, uint_key_compare);
if (table->ht == NULL) {
free(table);
_mesa_error_no_memory(__func__);
return NULL;
}
_mesa_hash_table_set_deleted_key(table->ht, uint_key(DELETED_KEY_VALUE));
mtx_init(&table->Mutex, mtx_plain);
mtx_init(&table->WalkMutex, mtx_plain);
}
else {
_mesa_error_no_memory(__func__);
}
return table;
}