[Libreoffice-commits] .: unoxml/source

Caolán McNamara caolan at kemper.freedesktop.org
Fri Dec 10 05:01:54 PST 2010


 unoxml/source/dom/element.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 8921201e2b3a06369d413cc991c2569349970619
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Dec 10 13:01:44 2010 +0000

    valgrind: unoxml leaks like a sieve

diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx
index 2918a01..00fe33a 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


More information about the Libreoffice-commits mailing list