[Common-cvs] log/logcommon hlxxmlparser.cpp,1.4,1.4.4.1
skharkar at helixcommunity.org skharkar at helixcommunity.orgUpdate of /cvsroot/common/log/logcommon
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv26398
Modified Files:
Tag: PRODUCER_12_5_RN
hlxxmlparser.cpp
Log Message:
ynopsis
============
common/log/logcommon/hlxxmlparser.cpp has a leak.
CHXTElement added to root node are not deleted.
Suggested Reviewer: Eric
Branches
=========
HEAD and PRODUCER_12_5_RN
Description
==============
CHXTElement objects are removed from m_stackElement in callback to endElement but there memory was not freed prior to this fix due to refounct issue.
When a root element was added, it was added as a clone. i.e. Root would have m_pData->ulRefCount as 2 and not 1. I think this might be done as earlier CHXTElement were removed from m_stackElement and then deleted. This was later on changed to just being removed from stack.
Fix was not to have a clone.
Also fixed the destructor of CHXTElement to use correct iterator.
Files affected
==================
common/log/logcommon/hlxxmlparser.cpp
Testing
=================
Verified that producer does not report huge leaks when using loading logmessages.xml. (Other leaks are still present)
QA Hints
=============
None
Index: hlxxmlparser.cpp
===================================================================
RCS file: /cvsroot/common/log/logcommon/hlxxmlparser.cpp,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -u -d -r1.4 -r1.4.4.1
--- hlxxmlparser.cpp 10 Mar 2009 20:00:50 -0000 1.4
+++ hlxxmlparser.cpp 3 Apr 2009 19:52:02 -0000 1.4.4.1
@@ -353,7 +353,7 @@
CHXPtrArray::Iterator ElementIter;
for(ElementIter = m_vChildElements.Begin(); ElementIter != m_vChildElements.End(); ++ElementIter)
{
- CHXTElement* pElem = (CHXTElement*)*iter;
+ CHXTElement* pElem = (CHXTElement*)*ElementIter;
HX_DELETE(pElem);
}
}
@@ -590,8 +590,7 @@
// stack then this must be the root element, so add it accordingly
if (pThis->m_stackElement.IsEmpty())
{
- CHXTElement* pNewElementClone = new CHXTElement(*pNewElement);
- pThis->AddRootElement(pNewElementClone);
+ pThis->AddRootElement(pNewElement);
}
else
{