From: Juha-Pekka Heikkila Date: Wed, 26 Feb 2014 12:03:19 +0000 (+0200) Subject: mesa: add missing null check in _mesa_NewHashTable() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=77a00c71bb3ecaafc9ceec035937c02e75a505b6;p=mesa.git mesa: add missing null check in _mesa_NewHashTable() Signed-off-by: Juha-Pekka Heikkila Reviewed-by: Ian Romanick --- diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 23018e9da31..674c29d650b 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; }