From: Brian Paul Date: Tue, 16 Feb 2010 15:21:28 +0000 (-0700) Subject: mesa: Test for failed malloc in _mesa_HashInsert. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=693f4af63dd98b963e91259029cc0131b791721c;p=mesa.git mesa: Test for failed malloc in _mesa_HashInsert. Signed-off-by: Brian Paul (cherry picked from commit 7c7247ddbf6e3f7f93e44c1cb52490044f1a2215) --- 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); }