diff options
author | Callum Linden <callum@lindenlab.com> | 2022-09-15 17:00:34 -0700 |
---|---|---|
committer | Callum Linden <callum@lindenlab.com> | 2022-09-15 17:00:34 -0700 |
commit | f08f20db5f9936956c2210b73011f7e2ff45af03 (patch) | |
tree | d8b8a5d77d65c0342c0d06a480e4382dc5ffd6ba /indra/llrender/llimagegl.cpp | |
parent | 5883ff178bb608b10eafe9bfa0aeb961d8afcecd (diff) | |
parent | f83289d3a7e80bebe47f696f96aee1b7e64d1d69 (diff) |
Merge branch 'master' into DRTVWR-568
Diffstat (limited to 'indra/llrender/llimagegl.cpp')
-rw-r--r-- | indra/llrender/llimagegl.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 9bd3a0a6b0..b9dc689d1a 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1248,7 +1248,12 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt if (pixels != nullptr) { use_scratch = true; - scratch = new U32[width * height]; + scratch = new(std::nothrow) U32[width * height]; + if (!scratch) + { + LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32)) + << " bytes for a manual image W" << width << " H" << height << LL_ENDL; + } U32 pixel_count = (U32)(width * height); for (U32 i = 0; i < pixel_count; i++) @@ -1268,7 +1273,12 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt if (pixels != nullptr) { use_scratch = true; - scratch = new U32[width * height]; + scratch = new(std::nothrow) U32[width * height]; + if (!scratch) + { + LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32)) + << " bytes for a manual image W" << width << " H" << height << LL_ENDL; + } U32 pixel_count = (U32)(width * height); for (U32 i = 0; i < pixel_count; i++) @@ -1291,7 +1301,12 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt if (pixels != nullptr) { use_scratch = true; - scratch = new U32[width * height]; + scratch = new(std::nothrow) U32[width * height]; + if (!scratch) + { + LL_ERRS() << "Failed to allocate " << (U32)(width * height * sizeof(U32)) + << " bytes for a manual image W" << width << " H" << height << LL_ENDL; + } U32 pixel_count = (U32)(width * height); for (U32 i = 0; i < pixel_count; i++) |