Commit a69dffbc authored by Koji Kobayashi's avatar Koji Kobayashi

make MemoryPoolAllocator's Malloc work after Clear if a buffer was not supplied by the user

parent a5ffc5be
......@@ -170,7 +170,7 @@ public:
//! Allocates a memory block. (concept Allocator)
void* Malloc(size_t size) {
size = RAPIDJSON_ALIGN(size);
if (chunkHead_->size + size > chunkHead_->capacity)
if (chunkHead_ == 0 || chunkHead_->size + size > chunkHead_->capacity)
AddChunk(chunk_capacity_ > size ? chunk_capacity_ : size);
void *buffer = reinterpret_cast<char *>(chunkHead_ + 1) + chunkHead_->size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment