mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Merge pull request #4624 from ctrlaltdavid/memory-fixes
Replace try with nothrow
This commit is contained in:
commit
3d6cf82659
1 changed files with 3 additions and 3 deletions
|
@ -27,9 +27,9 @@ Resource::Size Resource::Sysmem::allocateMemory(Byte** dataAllocated, Size size)
|
|||
if (size > 0) {
|
||||
// Try allocating as much as the required size + one block of memory
|
||||
newSize = size;
|
||||
try {
|
||||
(*dataAllocated) = new Byte[newSize];
|
||||
} catch (const std::bad_alloc&) {
|
||||
(*dataAllocated) = new (std::nothrow) Byte[newSize];
|
||||
// Failed?
|
||||
if (!(*dataAllocated)) {
|
||||
qWarning() << "Buffer::Sysmem::allocate() : Can't allocate a system memory buffer of " << newSize << "bytes. Fails to create the buffer Sysmem.";
|
||||
return NOT_ALLOCATED;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue