mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 08:10:14 +01:00
mesa: NULL check the pointer before trying to dereference it
Duh.
Fixes issues identified by Klocwork analysis:
Pointer 'table' returned from call to function 'calloc' at line 115
may be NULL and will be dereferenced at line 117.
and
Suspicious dereference of pointer 'table' before NULL check at line
119.
NOTE: This is a candidate for the stable branches.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
ee55b845d2
commit
2cc0b3294a
1 changed files with 2 additions and 2 deletions
|
|
@ -114,9 +114,9 @@ _mesa_NewHashTable(void)
|
|||
{
|
||||
struct _mesa_HashTable *table = CALLOC_STRUCT(_mesa_HashTable);
|
||||
|
||||
table->ht = _mesa_hash_table_create(NULL, uint_key_compare);
|
||||
_mesa_hash_table_set_deleted_key(table->ht, uint_key(DELETED_KEY_VALUE));
|
||||
if (table) {
|
||||
table->ht = _mesa_hash_table_create(NULL, uint_key_compare);
|
||||
_mesa_hash_table_set_deleted_key(table->ht, uint_key(DELETED_KEY_VALUE));
|
||||
_glthread_INIT_MUTEX(table->Mutex);
|
||||
_glthread_INIT_MUTEX(table->WalkMutex);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue