Memory Leak when parsing input with an undefined encoding
---------------------------------------------------------

         Key: XERCESC-1480
         URL: http://issues.apache.org/jira/browse/XERCESC-1480
     Project: Xerces-C++
        Type: Bug
    Versions: 2.6.0    
 Environment: Reproduced on:

Solaris 8: SunOS 5.8 Generic_117350-06 sun4u sparc SUNW,Sun-Fire-V240
Suse Linux 9.2: Linux 2.6.8-24.14-default #1 Tue Mar 29 09:27:43 UTC 2005 i686 
i686 i386 GNU/Linux
Windows 2000/XP SP 2
    Reporter: Tito Pena
    Priority: Minor


When creating an XMLReader object with an InputSource which has an unknown 
encoding, a TranscodingException is thrown, leaking the fPublicId, fSystemId 
and fEncodingStr members. This occurs on lines 261 and 357 in XMLReader.cpp.

I am including a diff -C3 patch for the fille.

*** ./xerces-c-src_2_6_0/src/xercesc/internal/XMLReader.cpp     Fri Aug 19 
13:19:46 2005
--- ./xerces-c-src_2_6_0/src/xercesc/internal/XMLReader.cpp.pat Fri Aug 19 
13:25:54 2005
***************
*** 258,263 ****
--- 258,267 ----
  
      if (!fTranscoder)
      {
+         fMemoryManager->deallocate(fPublicId);
+         fMemoryManager->deallocate(fSystemId);
+         ArrayJanitor<XMLCh> janValue(fEncodingStr, fMemoryManager);
+               
          ThrowXMLwithMemMgr1
          (
              TranscodingException
***************
*** 354,359 ****
--- 358,367 ----
  
      if (!fTranscoder)
      {
+         fMemoryManager->deallocate(fPublicId);
+         fMemoryManager->deallocate(fSystemId);
+         ArrayJanitor<XMLCh> janValue(fEncodingStr, fMemoryManager);
+ 
          ThrowXMLwithMemMgr1
          (
              TranscodingException


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to