DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5464>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5464

Memory Leak

           Summary: Memory Leak
           Product: Xerces-C++
           Version: 1.5.1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: DOM
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


DocumentImpl.cpp's DocumentImpl::importNode does not delete old attribute if 
its reference count equals zero.

The following diff compares 1.5.1 and a fix:

524,527c524,527
<           if (source->getLocalName() == null)
<               newelement = createElement(source->getNodeName());
<           else
<               newelement = createElementNS(source->getNamespaceURI(),
---
>                       if (source->getLocalName() == null)
>                               newelement = createElement(source->getNodeName
());
>                       else
>                               newelement = createElementNS(source-
>getNamespaceURI(),
530c530
<             if(srcattr!=null)
---
>             if (srcattr!=null)
532,541c532,550
<               {
<                   AttrImpl *attr = (AttrImpl *) srcattr->item(i);
<                   if (attr -> getSpecified()) { // not a default attribute
<                         AttrImpl *nattr = (AttrImpl *) importNode(attr, true);
<                       if (attr -> getLocalName() == null)
<                           newelement->setAttributeNode(nattr);
<                       else
<                           newelement->setAttributeNodeNS(nattr);
<                     }
<               }
---
>                               {
>                                       AttrImpl *attr = (AttrImpl *) srcattr-
>item(i);
>                                       if (attr -> getSpecified())
>                                       { // not a default attribute
>                                               AttrImpl *nattr = (AttrImpl *) 
importNode(attr, true);
>                                               AttrImpl * pOldAttr = null;
>                                               if (attr -> getLocalName() == 
null)
>                                                       pOldAttr = newelement-
>setAttributeNode(nattr);
>                                               else
>                                                       pOldAttr = newelement-
>setAttributeNodeNS(nattr);
>                                               if (pOldAttr)
>                                               {
>                                           if (pOldAttr->nodeRefCount == 0)
>                                                       
        NodeImpl::deleteIf
>                                                               
        (pOldAttr);
>                                               }
>                                       }
> 
>                               }

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

Reply via email to