summaryrefslogtreecommitdiff
path: root/unoxml
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2011-01-19 20:27:28 +0100
committerMichael Stahl <mst@openoffice.org>2011-01-19 20:27:28 +0100
commit34da472b449abca15c64f3d9254ec93fd0622898 (patch)
tree2467e6b73ba28f62230e7e7af5492375fdafef84 /unoxml
parent1dd96d5cd76ca9eecb73e96e6264396cfa1fc3a8 (diff)
xmlfix3: unoxml: CCharacterData: return value of xmlNodeGetContent was leaked
Diffstat (limited to 'unoxml')
-rw-r--r--unoxml/source/dom/characterdata.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/unoxml/source/dom/characterdata.cxx b/unoxml/source/dom/characterdata.cxx
index 237d5eae21c5..da72537edc02 100644
--- a/unoxml/source/dom/characterdata.cxx
+++ b/unoxml/source/dom/characterdata.cxx
@@ -29,6 +29,8 @@
#include <string.h>
+#include <boost/shared_ptr.hpp>
+
#include <com/sun/star/xml/dom/events/XDocumentEvent.hpp>
#include "../events/mutationevent.hxx"
@@ -88,7 +90,9 @@ namespace DOM
if (m_aNodePtr != NULL)
{
// get current data
- OString aData((const sal_Char*)xmlNodeGetContent(m_aNodePtr));
+ ::boost::shared_ptr<xmlChar const> const pContent(
+ xmlNodeGetContent(m_aNodePtr), xmlFree);
+ OString aData(reinterpret_cast<sal_Char const*>(pContent.get()));
OUString tmp(aData, aData.getLength(), RTL_TEXTENCODING_UTF8);
if (offset > tmp.getLength() || offset < 0 || count < 0) {
DOMException e;
@@ -157,7 +161,9 @@ namespace DOM
if (m_aNodePtr != NULL)
{
// get current data
- OString aData((const sal_Char*)xmlNodeGetContent(m_aNodePtr));
+ ::boost::shared_ptr<xmlChar const> const pContent(
+ xmlNodeGetContent(m_aNodePtr), xmlFree);
+ OString aData(reinterpret_cast<sal_Char const*>(pContent.get()));
OUString tmp(aData, aData.getLength(), RTL_TEXTENCODING_UTF8);
if (offset > tmp.getLength() || offset < 0) {
DOMException e;
@@ -190,7 +196,9 @@ namespace DOM
if (m_aNodePtr != NULL)
{
// get current data
- OString aData((const sal_Char*)xmlNodeGetContent(m_aNodePtr));
+ ::boost::shared_ptr<xmlChar const> const pContent(
+ xmlNodeGetContent(m_aNodePtr), xmlFree);
+ OString aData(reinterpret_cast<sal_Char const*>(pContent.get()));
OUString tmp(aData, aData.getLength(), RTL_TEXTENCODING_UTF8);
if (offset > tmp.getLength() || offset < 0 || count < 0){
DOMException e;