summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/hash.c
diff options
context:
space:
mode:
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>2014-02-26 14:03:19 +0200
committerTapani Pälli <tapani.palli@intel.com>2014-05-30 07:20:53 +0300
commit77a00c71bb3ecaafc9ceec035937c02e75a505b6 (patch)
tree050ad32856f81ddef1e959f420f34f6fc0bf8983 /src/mesa/main/hash.c
parent85b6f36ca5238dd3fec7c5fcacb8b7074ce53c8e (diff)
downloadexternal_mesa3d-77a00c71bb3ecaafc9ceec035937c02e75a505b6.zip
external_mesa3d-77a00c71bb3ecaafc9ceec035937c02e75a505b6.tar.gz
external_mesa3d-77a00c71bb3ecaafc9ceec035937c02e75a505b6.tar.bz2
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>
Diffstat (limited to 'src/mesa/main/hash.c')
-rw-r--r--src/mesa/main/hash.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 23018e9..674c29d 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -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;
}