I believe that Xerces-C++ 1.5.1 fixed some memory leaks. Anyway, it is
generally a good idea to check the latest version before reporting a
bug.

> Nick Chiang wrote:
> 
> Hi,
> 
> I found two places may have memory leak problem.
> 
>         First, in src/validators/common/DFAContentModel.cpp Line 464
> function DFAContentModel::buildDFA().
> 
>         statement:
>         QName* qname = new QName(XMLUni::fgZeroLenString,
> XMLUni::fgZeroLenString, XMLContentModel::gEOCFakeId);
> 
>         This needs to be freed after the next statement (CMLeaf*
> nodeEOC = new CMLeaf(qname);).
> 
>         Original Source Code:
> 
>         QName* qname = new QName(XMLUni::fgZeroLenString,
> XMLUni::fgZeroLenString, XMLContentModel::gEOCFakeId);
>             CMLeaf* nodeEOC = new CMLeaf(qname);
> 
>         To fix the memory leak:
> 
>         QName* qname = new QName(XMLUni::fgZeroLenString,
> XMLUni::fgZeroLenString, XMLContentModel::gEOCFakeId);
>             CMLeaf* nodeEOC = new CMLeaf(qname);
>         delete qname;
> 
>         Second, in src/validators/common/DFAContentModel.cpp Line 837.
> fHeadNode has to be deleted, since delete 'fLeafList' only remove the
> leaves in the tree. The other node such as CMAny, CMBinaryOp and
> CMUnaryOp won't be freed. In order to correct this problem there are
> some codes need to be change.
> 
>         Line: 836 Orig Code DFAContentModel.cpp
> 
>         //delete fHeadNode;
>             fHeadNode = 0;
> 
>         New Code
> 
>         delete fHeadNode;
>             //fHeadNode = 0;
> 
>         Line: 1046 Orig Code DFAContentModel.cpp
> 
>         fLeafList[newIndex] = (CMLeaf*)nodeCur;
> 
>         New Code
> 
>         fLeafList[newIndex] = new
> CMLeaf(((CMLeaf*)nodeCur)->getElement(),
> 
> ((CMLeaf*)nodeCur)->getPosition());
> 
> Regards,
> 
> Nick Chiang
> 
> PS: If you plan to fix the problem in future release, would you mind
> to let me know the release number. Thanks.
> 
> 

-- 
Murray Cumming
www.murrayc.com
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to