diff options
author | Brian Paul <brianp@vmware.com> | 2010-02-16 08:21:28 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2010-02-16 08:21:28 -0700 |
commit | 693f4af63dd98b963e91259029cc0131b791721c (patch) | |
tree | 3311532ba98f1fa113bf5d4cae2178283adaaa36 | |
parent | b0f9717105301ee85afee0d03ee7e62e3e883326 (diff) |
mesa: Test for failed malloc in _mesa_HashInsert.
Signed-off-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit 7c7247ddbf6e3f7f93e44c1cb52490044f1a2215)
-rw-r--r-- | src/mesa/main/hash.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 08c64568c8..7c3c7a6bdb 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); } |