Author: borisk
Date: Wed Nov 4 15:11:14 2009
New Revision: 832766
URL: http://svn.apache.org/viewvc?rev=832766&view=rev
Log:
Free resources if we throw from c-tors (XERCESC-1480).
Modified:
xerces/c/trunk/src/xercesc/internal/XMLReader.cpp
Modified: xerces/c/trunk/src/xercesc/internal/XMLReader.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XMLReader.cpp?rev=832766&r1=832765&r2=832766&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLReader.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLReader.cpp Wed Nov 4 15:11:14 2009
@@ -311,6 +311,13 @@
if (!fTranscoder)
{
+ // We are about to throw which means the d-tor won't be called.
+ // Clean up some memory.
+ //
+ fMemoryManager->deallocate(fPublicId);
+ fMemoryManager->deallocate(fSystemId);
+ ArrayJanitor<XMLCh> jan (fEncodingStr, fMemoryManager);
+
ThrowXMLwithMemMgr1
(
TranscodingException
@@ -407,6 +414,13 @@
if (!fTranscoder)
{
+ // We are about to throw which means the d-tor won't be called.
+ // Clean up some memory.
+ //
+ fMemoryManager->deallocate(fPublicId);
+ fMemoryManager->deallocate(fSystemId);
+ ArrayJanitor<XMLCh> jan (fEncodingStr, fMemoryManager);
+
ThrowXMLwithMemMgr1
(
TranscodingException
@@ -736,7 +750,7 @@
{
if (fCharIndex == fCharsAvail)
{
- // we have to copy the accepted character(s), and update the
column number,
+ // we have to copy the accepted character(s), and update the
column number,
// before getting new data and losing the value of fCharIndex
if((count = fCharIndex - charIndex_start)!=0)
{
@@ -749,7 +763,7 @@
}
// Check the current char and take it if it's a name char
- if (fXMLVersion == XMLV1_1)
+ if (fXMLVersion == XMLV1_1)
{
while(fCharIndex < fCharsAvail)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]