You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/06/13 18:42:37 UTC
cvs commit: xml-xerces/c/src/parsers DOMParser.cpp
tng 01/06/13 09:42:36
Modified: c/src/parsers DOMParser.cpp
Log:
[Bug 812] Memory leak with multiple !ATTLIST on single !ELEMENT. By Erik Rydgren.
Revision Changes Path
1.53 +21 -3 xml-xerces/c/src/parsers/DOMParser.cpp
Index: DOMParser.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/parsers/DOMParser.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- DOMParser.cpp 2001/06/03 19:26:18 1.52
+++ DOMParser.cpp 2001/06/13 16:42:33 1.53
@@ -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.52 2001/06/03 19:26:18 jberry Exp $
+* $Id: DOMParser.cpp,v 1.53 2001/06/13 16:42:33 tng Exp $
*
*/
@@ -1038,7 +1038,16 @@
insertAttr->setSpecified(false);
}
}
- fDocumentType->getElements()->setNamedItem(elem);
+ ElementImpl *previousElem = (ElementImpl *)
+ fDocumentType->getElements()->setNamedItem( elem );
+
+ //
+ // If this new element is replacing an element node that was already
+ // in the element named node map, we need to delete the original
+ // element node, assuming no-one else was referencing it.
+ //
+ if (previousElem != 0 && previousElem->nodeRefCount == 0)
+ NodeImpl::deleteIf(previousElem);
}
}
@@ -1143,8 +1152,17 @@
NotationImpl* notation = ((DocumentImpl*)fDocument.fImpl)->createNotation(notDecl.getName());
notation->setPublicId(notDecl.getPublicId());
notation->setSystemId(notDecl.getSystemId());
+
+ NotationImpl *previousNot = (NotationImpl *)
+ fDocumentType->notations->setNamedItem( notation );
- fDocumentType->notations->setNamedItem( notation );
+ //
+ // If this new notation is replacing a notation node that was already
+ // in the notation named node map, we need to delete the original
+ // notation node, assuming no-one else was referencing it.
+ //
+ if (previousNot != 0 && previousNot->nodeRefCount == 0)
+ NodeImpl::deleteIf(previousNot);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org