[Libreoffice-commits] libvisio.git: 2 commits - src/lib
David Tardon
dtardon at redhat.com
Tue Sep 26 15:13:55 UTC 2017
src/lib/VDXParser.cpp | 4 ++--
src/lib/VSDXParser.cpp | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 93a653b83a8a22a674d74b876fb09cc2ad4a8994
Author: David Tardon <dtardon at redhat.com>
Date: Tue Sep 26 17:11:55 2017 +0200
avoid possible leak
Change-Id: I3364eb94f626d5507d296bf322856e2452795e87
diff --git a/src/lib/VSDXParser.cpp b/src/lib/VSDXParser.cpp
index 2c1694f..488be3a 100644
--- a/src/lib/VSDXParser.cpp
+++ b/src/lib/VSDXParser.cpp
@@ -552,11 +552,11 @@ void libvisio::VSDXParser::extractBinaryData(librevenge::RVNGInputStream *input,
xmlChar *libvisio::VSDXParser::readStringData(xmlTextReaderPtr reader)
{
- xmlChar *stringValue = xmlTextReaderGetAttribute(reader, BAD_CAST("V"));
+ std::unique_ptr<xmlChar, void (*)(void *)> stringValue(xmlTextReaderGetAttribute(reader, BAD_CAST("V")), xmlFree);
if (stringValue)
{
VSD_DEBUG_MSG(("VSDXParser::readStringData stringValue %s\n", (const char *)stringValue));
- return stringValue;
+ return stringValue.release();
}
return nullptr;
}
commit 7739316072ae4a95b1225067b944828429380fd7
Author: David Tardon <dtardon at redhat.com>
Date: Tue Sep 26 17:04:34 2017 +0200
ofz#3210 do not leak string
Change-Id: I5e0127e59438345a51c7037be64edf9ee5f3f565
diff --git a/src/lib/VDXParser.cpp b/src/lib/VDXParser.cpp
index ef6f7c6..f2f3154 100644
--- a/src/lib/VDXParser.cpp
+++ b/src/lib/VDXParser.cpp
@@ -912,12 +912,12 @@ xmlChar *libvisio::VDXParser::readStringData(xmlTextReaderPtr reader)
int ret = xmlTextReaderRead(reader);
if (1 == ret && XML_READER_TYPE_TEXT == xmlTextReaderNodeType(reader))
{
- xmlChar *stringValue = xmlTextReaderValue(reader);
+ std::unique_ptr<xmlChar, void (*)(void *)> stringValue(xmlTextReaderValue(reader), xmlFree);
ret = xmlTextReaderRead(reader);
if (1 == ret && stringValue)
{
VSD_DEBUG_MSG(("VDXParser::readStringData stringValue %s\n", (const char *)stringValue));
- return stringValue;
+ return stringValue.release();
}
}
return nullptr;
More information about the Libreoffice-commits
mailing list