From 693f4af63dd98b963e91259029cc0131b791721c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 16 Feb 2010 08:21:28 -0700 Subject: mesa: Test for failed malloc in _mesa_HashInsert. Signed-off-by: Brian Paul (cherry picked from commit 7c7247ddbf6e3f7f93e44c1cb52490044f1a2215) --- src/mesa/main/hash.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 08c64568c83..7c3c7a6bdbb 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -191,10 +191,12 @@ _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data) /* alloc and insert new table entry */ entry = MALLOC_STRUCT(HashEntry); - entry->Key = key; - entry->Data = data; - entry->Next = table->Table[pos]; - table->Table[pos] = entry; + if (entry) { + entry->Key = key; + entry->Data = data; + entry->Next = table->Table[pos]; + table->Table[pos] = entry; + } _glthread_UNLOCK_MUTEX(table->Mutex); } -- cgit v1.2.3