Fix memory leak in LinearAllocator used by Sample_TempObstacles
This commit is contained in:
parent
d7187028b2
commit
b05e45492e
@ -132,11 +132,11 @@ struct FastLZCompressor : public dtTileCacheCompressor
|
||||
struct LinearAllocator : public dtTileCacheAlloc
|
||||
{
|
||||
unsigned char* buffer;
|
||||
int capacity;
|
||||
int top;
|
||||
int high;
|
||||
size_t capacity;
|
||||
size_t top;
|
||||
size_t high;
|
||||
|
||||
LinearAllocator(const int cap) : buffer(0), capacity(0), top(0), high(0)
|
||||
LinearAllocator(const size_t cap) : buffer(0), capacity(0), top(0), high(0)
|
||||
{
|
||||
resize(cap);
|
||||
}
|
||||
@ -146,7 +146,7 @@ struct LinearAllocator : public dtTileCacheAlloc
|
||||
dtFree(buffer);
|
||||
}
|
||||
|
||||
void resize(const int cap)
|
||||
void resize(const size_t cap)
|
||||
{
|
||||
if (buffer) dtFree(buffer);
|
||||
buffer = (unsigned char*)dtAlloc(cap, DT_ALLOC_PERM);
|
||||
@ -159,7 +159,7 @@ struct LinearAllocator : public dtTileCacheAlloc
|
||||
top = 0;
|
||||
}
|
||||
|
||||
virtual void* alloc(const int size)
|
||||
virtual void* alloc(const size_t size)
|
||||
{
|
||||
if (!buffer)
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user