[Libreoffice-commits] online.git: loolwsd/ChildSession.cpp loolwsd/LOKitHelper.hpp
Henry Castro
hcastro at collabora.com
Wed May 25 04:32:20 UTC 2016
loolwsd/ChildSession.cpp | 5 ++++-
loolwsd/LOKitHelper.hpp | 9 +++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
New commits:
commit bf1a4705e4d343b4a6031e85d8d3644decf3ddac
Author: Henry Castro <hcastro at 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);
}
}
}
More information about the Libreoffice-commits
mailing list