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 2004/06/15 23:28:02 UTC
cvs commit: xml-xerces/c/src/xercesc/internal DGXMLScanner.cpp IGXMLScanner.cpp
peiyongz 2004/06/15 14:28:02
Modified: c/src/xercesc/internal DGXMLScanner.cpp IGXMLScanner.cpp
Log:
Memory Leakage Fixed , patch from David Bertoni
Revision Changes Path
1.49 +6 -9 xml-xerces/c/src/xercesc/internal/DGXMLScanner.cpp
Index: DGXMLScanner.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/DGXMLScanner.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- DGXMLScanner.cpp 2 Jun 2004 19:58:09 -0000 1.48
+++ DGXMLScanner.cpp 15 Jun 2004 21:28:02 -0000 1.49
@@ -853,6 +853,8 @@
, DTDElementDecl::Any
, fGrammarPoolMemoryManager
);
+
+ Janitor<DTDElementDecl> rootDeclJanitor(rootDecl);
rootDecl->setCreateReason(DTDElementDecl::AsRootElem);
rootDecl->setExternalElemDeclaration(true);
if(!fUseCachedGrammar)
@@ -860,14 +862,8 @@
// this will break getRootElemId on DTDGrammar when
// cached grammars are in use, but
// why would one use this anyway???
- try {
- ((DTDGrammar*)fGrammar)->setRootElemId(fGrammar->putElemDecl(rootDecl));
- }
- catch(const XMLException&)
- {
- delete rootDecl;
- throw;
- }
+ ((DTDGrammar*)fGrammar)->setRootElemId(fGrammar->putElemDecl(rootDecl));
+ rootDeclJanitor.release();
} else
{
// put this in the undeclared pool so it gets deleted...
@@ -879,6 +875,7 @@
else
{
rootDecl->setId(fDTDElemNonDeclPool->put((DTDElementDecl*)rootDecl));
+ rootDeclJanitor.release();
}
}
1.71 +6 -9 xml-xerces/c/src/xercesc/internal/IGXMLScanner.cpp
Index: IGXMLScanner.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/IGXMLScanner.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- IGXMLScanner.cpp 2 Jun 2004 19:58:09 -0000 1.70
+++ IGXMLScanner.cpp 15 Jun 2004 21:28:02 -0000 1.71
@@ -1349,6 +1349,8 @@
, DTDElementDecl::Any
, fGrammarPoolMemoryManager
);
+
+ Janitor<DTDElementDecl> rootDeclJanitor(rootDecl);
rootDecl->setCreateReason(DTDElementDecl::AsRootElem);
rootDecl->setExternalElemDeclaration(true);
if(!fUseCachedGrammar)
@@ -1356,14 +1358,8 @@
// this will break getRootElemId on DTDGrammar when
// cached grammars are in use, but
// why would one use this anyway???
- try {
- ((DTDGrammar*)fGrammar)->setRootElemId(fGrammar->putElemDecl(rootDecl));
- }
- catch(const XMLException&)
- {
- delete rootDecl;
- throw;
- }
+ ((DTDGrammar*)fGrammar)->setRootElemId(fGrammar->putElemDecl(rootDecl));
+ rootDeclJanitor.release();
} else
{
// attach this to the undeclared element pool so that it gets deleted
@@ -1375,6 +1371,7 @@
else
{
rootDecl->setId(fDTDElemNonDeclPool->put((DTDElementDecl*)rootDecl));
+ rootDeclJanitor.release();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org