[Libreoffice-commits] online.git: loolwsd/ChildSession.cpp
Henry Castro
hcastro at collabora.com
Tue May 31 14:16:00 UTC 2016
loolwsd/ChildSession.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 2df8d928dcaceae59e8b6ce0256b319b70d1933d
Author: Henry Castro <hcastro at collabora.com>
Date: Tue May 31 10:12:03 2016 -0400
loolwsd: remove unique_ptr to call std:free
It is recommended that if you allocate with malloc() it should
be deallocated with free()
diff --git a/loolwsd/ChildSession.cpp b/loolwsd/ChildSession.cpp
index e102405..0f07e73 100644
--- a/loolwsd/ChildSession.cpp
+++ b/loolwsd/ChildSession.cpp
@@ -653,16 +653,16 @@ bool ChildSession::sendFontRendering(const char* /*buffer*/, int /*length*/, Str
Timestamp timestamp;
int width, height;
unsigned char* ptrFont = _loKitDocument->renderFont(decodedFont.c_str(), &width, &height);
- std::unique_ptr<unsigned char[]> pixmap(ptrFont);
- std::free(ptrFont);
Log::trace("renderFont [" + font + "] rendered in " + std::to_string(timestamp.elapsed()/1000.) + "ms");
- if (!pixmap ||
- !png::encodeBufferToPNG(pixmap.get(), width, height, output, LOK_TILEMODE_RGBA))
+ if (!ptrFont ||
+ !png::encodeBufferToPNG(ptrFont, width, height, output, LOK_TILEMODE_RGBA))
{
+ std::free(ptrFont);
return sendTextFrame("error: cmd=renderfont kind=failure");
}
+ std::free(ptrFont);
return sendBinaryFrame(output.data(), output.size());
}
More information about the Libreoffice-commits
mailing list