Fixed scoped allocator -- this should have never worked

This commit is contained in:
Pavel Krajcevski 2015-12-20 16:24:17 -05:00
parent 8a1906e7b7
commit 6f2ee27a0e
2 changed files with 2 additions and 8 deletions

View File

@ -63,12 +63,7 @@ namespace FasTC {
T *m_Ptr;
ScopedAllocator() : m_Ptr(NULL) { }
public:
static ScopedAllocator<T> Create(uint32 nBytes) {
ScopedAllocator<T> actr;
actr.m_Ptr = new T[nBytes];
return actr;
}
ScopedAllocator<T>(uint32 nBytes) : m_Ptr(new T[nBytes]) { }
~ScopedAllocator() {
if(m_Ptr) {
delete [] m_Ptr;

View File

@ -205,8 +205,7 @@ bool ImageLoaderKTX::ReadData() {
const uint8 *imgData = rdr.GetData() + bytesOfKeyValueData;
while(rdr.GetData() < imgData) {
LOAD(keyAndValueByteSize);
FasTC::ScopedAllocator<uint8> keyValueData =
FasTC::ScopedAllocator<uint8>::Create(keyAndValueByteSize);
FasTC::ScopedAllocator<uint8> keyValueData(keyAndValueByteSize);
if(!keyValueData) {
fprintf(stderr, "KTX loader - out of memory.\n");
return false;