You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by pe...@apache.org on 2002/03/20 00:41:13 UTC

cvs commit: xml-xerces/c/src/xercesc/parsers DOMParser.cpp

peiyongz    02/03/19 15:41:13

  Modified:    c/src/xercesc/parsers DOMParser.cpp
  Log:
  Fix to Bug# 7164: DOMParser with a DTD leak!
  
  Revision  Changes    Path
  1.2       +6 -2      xml-xerces/c/src/xercesc/parsers/DOMParser.cpp
  
  Index: DOMParser.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/parsers/DOMParser.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DOMParser.cpp	1 Feb 2002 22:22:05 -0000	1.1
  +++ DOMParser.cpp	19 Mar 2002 23:41:13 -0000	1.2
  @@ -59,7 +59,7 @@
   *  handler with the scanner. In these handler methods, appropriate DOM nodes
   *  are created and added to the DOM tree.
   *
  -* $Id: DOMParser.cpp,v 1.1 2002/02/01 22:22:05 peiyongz Exp $
  +* $Id: DOMParser.cpp,v 1.2 2002/03/19 23:41:13 peiyongz Exp $
   *
   */
   
  @@ -1072,7 +1072,11 @@
                       insertAttr = new AttrImpl((DocumentImpl*)fDocument.fImpl, attr->getFullName());
                   }
                   insertAttr->setValue(attr->getValue());
  -                elem->setAttributeNode(insertAttr);
  +                // memory leak here
  +                AttrImpl * previousAttr = elem->setAttributeNode(insertAttr);
  +				if ( previousAttr != 0 && previousAttr->nodeRefCount ==0)
  +					NodeImpl::deleteIf(previousAttr);
  +
                   insertAttr->setSpecified(false);
               }
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org