loolwsd/ChildSession.cpp | 5 ++++- loolwsd/LOKitHelper.hpp | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-)
New commits: commit bf1a4705e4d343b4a6031e85d8d3644decf3ddac Author: Henry Castro <hcas...@collabora.com> Date: Wed May 25 00:32:00 2016 -0400 loolwsd: deallocates memory previously allocated by malloc diff --git a/loolwsd/ChildSession.cpp b/loolwsd/ChildSession.cpp index 8587e25..ca0d430 100644 --- a/loolwsd/ChildSession.cpp +++ b/loolwsd/ChildSession.cpp @@ -695,7 +695,10 @@ bool ChildSession::getCommandValues(const char* /*buffer*/, int /*length*/, Stri if (_multiView) _loKitDocument->setView(_viewId); - return sendTextFrame("commandvalues: " + std::string(_loKitDocument->getCommandValues(command.c_str()))); + char* ptrValues = _loKitDocument->getCommandValues(command.c_str()); + bool success = sendTextFrame("commandvalues: " + std::string(ptrValues)); + std::free(ptrValues); + return success; } bool ChildSession::getPartPageRectangles(const char* /*buffer*/, int /*length*/) diff --git a/loolwsd/LOKitHelper.hpp b/loolwsd/LOKitHelper.hpp index cfc3fec..46d40b1 100644 --- a/loolwsd/LOKitHelper.hpp +++ b/loolwsd/LOKitHelper.hpp @@ -107,6 +107,7 @@ namespace LOKitHelper inline std::string documentStatus(LibreOfficeKitDocument *loKitDocument) { + char* ptrValue; assert(loKitDocument && "null loKitDocument"); const auto type = static_cast<LibreOfficeKitDocumentType>(loKitDocument->pClass->getDocumentType(loKitDocument)); @@ -128,11 +129,15 @@ namespace LOKitHelper oss << "\n"; if (type == LOK_DOCTYPE_PRESENTATION) { - oss << loKitDocument->pClass->getPartHash(loKitDocument, i); + ptrValue = loKitDocument->pClass->getPartHash(loKitDocument, i); + oss << ptrValue; + std::free(ptrValue); } else { - oss << loKitDocument->pClass->getPartName(loKitDocument, i); + ptrValue = loKitDocument->pClass->getPartName(loKitDocument, i); + oss << ptrValue; + std::free(ptrValue); } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits