From b84c11696a4a283767258c4ae97c209833162eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 10 Dec 2010 13:01:44 +0000 Subject: [PATCH] valgrind: unoxml leaks like a sieve --- unoxml/source/dom/element.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx index 1f86e33c9185..cc8bde8fd0cd 100644 --- a/unoxml/source/dom/element.cxx +++ b/unoxml/source/dom/element.cxx @@ -209,8 +209,10 @@ namespace DOM { OString o1 = OUStringToOString(name, RTL_TEXTENCODING_UTF8); xmlChar *xValue = xmlGetProp(m_aNodePtr, (xmlChar*)o1.getStr()); - if (xValue != NULL) { + if (xValue != NULL) + { aValue = OUString((sal_Char*)xValue, strlen((char*)xValue), RTL_TEXTENCODING_UTF8); + xmlFree(xValue); } } return aValue; @@ -269,7 +271,8 @@ namespace DOM OString o2 = OUStringToOString(namespaceURI, RTL_TEXTENCODING_UTF8); xmlChar *xNS = (xmlChar*)o2.getStr(); xmlChar *xValue = (xmlChar*)xmlGetNsProp(m_aNodePtr, xName, xNS); - if (xValue != NULL) { + if (xValue != NULL) + { aValue = OUString((sal_Char*)xValue, strlen((char*)xValue), RTL_TEXTENCODING_UTF8); xmlFree(xValue); } @@ -511,6 +514,7 @@ namespace DOM else { oldValue = OUString((char*)xOld, strlen((char*)xOld), RTL_TEXTENCODING_UTF8); + xmlFree(xOld); xmlSetProp(m_aNodePtr, xName, xValue); } @@ -583,6 +587,7 @@ namespace DOM else { oldValue = OUString((char *)xOld, strlen((char *)xOld), RTL_TEXTENCODING_UTF8); + xmlFree(xOld); xmlSetNsProp(m_aNodePtr, pNs, xLName, xValue); } // dispatch DOMAttrModified event