diff options
author | Michael Stahl <mst@openoffice.org> | 2011-02-10 16:45:05 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2011-02-10 16:45:05 +0100 |
commit | 57f257b867aa26aabc12fc2325bd2d0d171ec31e (patch) | |
tree | 875890dbc5ff936bbc6df4cd4f63c1c39ffebbed /unoxml | |
parent | xmlfix3: #i113683#: unoxml: all unimplemented methods assert (diff) | |
download | core-57f257b867aa26aabc12fc2325bd2d0d171ec31e.tar.gz core-57f257b867aa26aabc12fc2325bd2d0d171ec31e.zip |
xmlfix3: unoxml: valgrind found some more memory leaks
Diffstat (limited to 'unoxml')
-rw-r--r-- | unoxml/source/dom/characterdata.cxx | 4 | ||||
-rw-r--r-- | unoxml/source/dom/document.cxx | 11 | ||||
-rw-r--r-- | unoxml/source/xpath/xpathobject.cxx | 6 |
3 files changed, 13 insertions, 8 deletions
diff --git a/unoxml/source/dom/characterdata.cxx b/unoxml/source/dom/characterdata.cxx index da72537edc02..6cd3d9f2c1d5 100644 --- a/unoxml/source/dom/characterdata.cxx +++ b/unoxml/source/dom/characterdata.cxx @@ -251,7 +251,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; diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index 8d42f65a6cd5..26e3b2cfe2f6 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -440,11 +440,11 @@ namespace DOM OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8); xmlChar *xName = (xmlChar*)o1.getStr(); xmlAttrPtr const pAttr = xmlNewDocProp(m_aDocPtr, xName, NULL); - Reference< XAttr > const xRet( - static_cast< XNode* >(GetCNode( - reinterpret_cast<xmlNodePtr>(pAttr)).get()), - UNO_QUERY_THROW); - return xRet; + ::rtl::Reference< CAttr > const pCAttr( + dynamic_cast< CAttr* >(GetCNode( + reinterpret_cast<xmlNodePtr>(pAttr)).get())); + pCAttr->m_bUnlinked = true; + return pCAttr.get(); }; // Creates an attribute of the given qualified name and namespace URI. @@ -478,6 +478,7 @@ namespace DOM if (!pCAttr.is()) { throw RuntimeException(); } // store the namespace data! pCAttr->m_pNamespace.reset( new stringpair_t(oUri, oPrefix) ); + pCAttr->m_bUnlinked = true; return pCAttr.get(); }; diff --git a/unoxml/source/xpath/xpathobject.cxx b/unoxml/source/xpath/xpathobject.cxx index 48b680698e87..36fdf1ba933e 100644 --- a/unoxml/source/xpath/xpathobject.cxx +++ b/unoxml/source/xpath/xpathobject.cxx @@ -173,8 +173,10 @@ namespace XPath { ::osl::MutexGuard const g(m_rMutex); - const sal_Char* x1 = (sal_Char*) xmlXPathCastToString(m_pXPathObj.get()); - return OUString(x1, strlen(x1), RTL_TEXTENCODING_UTF8); + ::boost::shared_ptr<xmlChar const> str( + xmlXPathCastToString(m_pXPathObj.get()), xmlFree); + sal_Char const*const pS(reinterpret_cast<sal_Char const*>(str.get())); + return OUString(pS, strlen(pS), RTL_TEXTENCODING_UTF8); } } |