summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2013-04-08 19:55:18 -0700
committerIan Romanick <[email protected]>2013-05-10 16:41:30 -0700
commit93613693ad70a34d0644149ae700daa3e2929286 (patch)
treec9e361569bb77d5e521c04ab21c62d765ea694f3 /src/mesa/main
parent377213b3ee716ac9c607e8250692da4037264328 (diff)
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 <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> (cherry picked from commit 2cc0b3294ae0b1181bdcbca91fd68ebab374dbb2)
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/hash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 8c763e20a90..9b9fff808bc 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -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);
}