summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2018-01-29 12:40:44 +0000
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2018-01-29 12:40:44 +0000
commit4526be61403539144062dbbdd3fbbd89aa472b5d (patch)
tree9aa6ef8abf3c88ce3947fe8c3065adba63f90662 /indra/newview
parent5ed2790ff97232daf1cfe2ad5a70914486e4cb3d (diff)
MAINT-8234 Mesh tread protections and removed unnecessary try in staticRun()
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llmeshrepository.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 51ca7a8a51..fdaa28b22b 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1224,7 +1224,12 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id)
LLMeshRepository::sCacheBytesRead += size;
++LLMeshRepository::sCacheReads;
file.seek(offset);
- U8* buffer = new U8[size];
+ U8* buffer = new(std::nothrow) U8[size];
+ if (!buffer)
+ {
+ LL_WARNS(LOG_MESH) << "Failed to allocate memory for skin info" << LL_ENDL;
+ return false;
+ }
file.read(buffer, size);
//make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)
@@ -1316,7 +1321,12 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id)
++LLMeshRepository::sCacheReads;
file.seek(offset);
- U8* buffer = new U8[size];
+ U8* buffer = new(std::nothrow) U8[size];
+ if (!buffer)
+ {
+ LL_WARNS(LOG_MESH) << "Failed to allocate memory for mesh decomposition" << LL_ENDL;
+ return false;
+ }
file.read(buffer, size);
//make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)
@@ -1407,7 +1417,12 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id)
LLMeshRepository::sCacheBytesRead += size;
++LLMeshRepository::sCacheReads;
file.seek(offset);
- U8* buffer = new U8[size];
+ U8* buffer = new(std::nothrow) U8[size];
+ if (!buffer)
+ {
+ LL_WARNS(LOG_MESH) << "Failed to allocate memory for physics shape" << LL_ENDL;
+ return false;
+ }
file.read(buffer, size);
//make sure buffer isn't all 0's by checking the first 1KB (reserved block but not written)