summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llmeshrepository.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index c4d1917567..c2a0393170 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1586,7 +1586,12 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
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) << "Can't allocate memory for mesh LOD" << 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)