You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Dean Roddey <dr...@portal.com> on 2001/03/02 19:20:34 UTC

RE: [Bug 812] New - Memory leak with multiple !ATTLIST on single !ELEMENT

The component is incorrect here. Its not the validator that's in error.
According to the text description, its actually in the DOMParser where this
is happening, right?

--------------
Dean Roddey
Software Geek Extraordinaire
Portal, Inc
droddey@portal.com



-----Original Message-----
From: bugzilla@apache.org [mailto:bugzilla@apache.org]
Sent: Friday, March 02, 2001 5:02 AM
To: xerces-c-dev@xml.apache.org
Subject: [Bug 812] New - Memory leak with multiple !ATTLIST on single
!ELEMENT


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

*** shadow/812	Fri Mar  2 05:01:32 2001
--- shadow/812.tmp.23006	Fri Mar  2 05:01:32 2001
***************
*** 0 ****
--- 1,47 ----
+
+===========================================================================
=+
+ | Memory leak with multiple !ATTLIST on single !ELEMENT
|
+
+---------------------------------------------------------------------------
-+
+ |        Bug #: 812                         Product: Xerces-C
|
+ |       Status: NEW                         Version: 1.4
|
+ |   Resolution:                            Platform: PC
|
+ |     Severity: Normal                   OS/Version:
|
+ |     Priority:                           Component: Validating Parser
(DTD) |
+
+---------------------------------------------------------------------------
-+
+ |  Assigned To: xerces-c-dev@xml.apache.org
|
+ |  Reported By: erik.rydgren@mandarinen.se
|
+ |      CC list: Cc:
|
+
+---------------------------------------------------------------------------
-+
+ |          URL:
|
+
+===========================================================================
=+
+ |                              DESCRIPTION
|
+ When using a DTD like this
+ 
+ <!ELEMENT foo EMPTY>
+ <!ATTLIST foo foobar CDATA #REQUIRED>
+ <!ATTLIST foo2 foobar2 CDATA #REQUIRED>
+ 
+ The validator leaks memory for each ATTLIST declaration following the
first. 
+ Tracked the problem to this sourceline.
+ DOMParser.cpp (line ~1040)
+ 
+         fDocumentType->entities->setNamedItem( elem );
+ 
+ If there alredy was an element with that name, it just flies away into the
void.
+ Proposed change:
+ 
+         EntityImpl *previousElem = (EntityImpl *)
+ 	        fDocumentType->entities->setNamedItem( elem ); 
+ 
+         //
+         //  If this new entity node is replacing an entity node that was
already
+         //    in the entities named node map, we need to delete the
original
+         //    entitiy node, assuming no-one else was referencing it.
+         //
+         if (previousElem != 0 && previousElem->nodeRefCount == 0)
+             NodeImpl::deleteIf(previousElem);
+ 
+ Did the change on my build, works like a charm.
+ 
+ Regards
+ Erik Rydgren
+ Mandarinen Systems AB, Sweden

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