diff options
author | Michael Stahl <mst@openoffice.org> | 2011-01-19 20:27:28 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2011-01-19 20:27:28 +0100 |
commit | 34da472b449abca15c64f3d9254ec93fd0622898 (patch) | |
tree | 2467e6b73ba28f62230e7e7af5492375fdafef84 /unoxml | |
parent | xmlfix3: unoxml: CAttr cleanup: always check m_aNodePtr (diff) | |
download | core-34da472b449abca15c64f3d9254ec93fd0622898.tar.gz core-34da472b449abca15c64f3d9254ec93fd0622898.zip |
xmlfix3: unoxml: CCharacterData: return value of xmlNodeGetContent was leaked
Diffstat (limited to 'unoxml')
-rw-r--r-- | unoxml/source/dom/characterdata.cxx | 14 |
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; |