Hi,
FYI, another memory leak we found in log4cxx 0.9.7 (this is an old version!):
During parsing, allocated XML attributes are not freed again.
Detected with valgrind/memcheck analysis.
Here's a fix:
(Base is 0.9.7)
\src\gnomexml.cpp:
@@ -126,6 +126,7 @@
if (attributeValue != 0
&& elementId ==
A2T(attributeValue))
{
+ xmlFree(attributeValue);
return new
GnomeXMLDOMElement(node);
}
}
@@ -178,7 +179,18 @@
USES_CONVERSION;
char * attributeValue = (char *)xmlGetProp(
element, (const xmlChar *)T2A(name.c_str()));
- return (attributeValue == 0) ? String() : A2T(attributeValue);
+ String ret;
+ if (attributeValue == 0)
+ {
+ ret=String();
+ }
+ else
+ {
+ ret=A2T(attributeValue);
+ xmlFree(attributeValue);
+ }
+ return ret;
+ //return (attributeValue == 0) ? String() : A2T(attributeValue);
}
// GnomeXMLDOMNodeList
Best regards,
Lars Ruoff