summaryrefslogtreecommitdiff
path: root/tools/source
diff options
context:
space:
mode:
Diffstat (limited to 'tools/source')
-rw-r--r--tools/source/misc/json_writer.cxx5
1 files changed, 1 insertions, 4 deletions
diff --git a/tools/source/misc/json_writer.cxx b/tools/source/misc/json_writer.cxx
index b6482329ea55..f002ddc391aa 100644
--- a/tools/source/misc/json_writer.cxx
+++ b/tools/source/misc/json_writer.cxx
@@ -413,10 +413,7 @@ void JsonWriter::reallocBuffer(int noMoreBytesRequired)
{
int currentUsed = mPos - mpBuffer;
auto newSize = std::max<int>(mSpaceAllocated * 2, (currentUsed + noMoreBytesRequired) * 2);
- char* pNew = static_cast<char*>(malloc(newSize));
- memcpy(pNew, mpBuffer, currentUsed);
- free(mpBuffer);
- mpBuffer = pNew;
+ mpBuffer = static_cast<char*>(realloc(mpBuffer, newSize));
mPos = mpBuffer + currentUsed;
mSpaceAllocated = newSize;
}