diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2017-07-28 00:41:25 +0300 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2017-07-28 00:41:25 +0300 |
commit | 304de39ff1b7d7c897adff50a71488e3361442d7 (patch) | |
tree | 2563253cb6e79c996f638b57df2bb8712e749b70 | |
parent | c3f8eb716162f8cec2b2af2a881807b455c81597 (diff) |
MAINT-7632 Crash in LLMeshRepoThread::fetchMeshLOD() - added allocation check
-rw-r--r-- | indra/newview/llmeshrepository.cpp | 7 |
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) |