You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by sc...@apache.org on 2017/07/13 22:53:07 UTC
svn commit: r1801896 - /xerces/c/trunk/src/xercesc/internal/XMLReader.cpp
Author: scantor
Date: Thu Jul 13 22:53:07 2017
New Revision: 1801896
URL: http://svn.apache.org/viewvc?rev=1801896&view=rev
Log:
XERCESC-2094 - Memory leak related to invalid encoding
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=1801896&r1=1801895&r2=1801896&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLReader.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLReader.cpp Thu Jul 13 22:53:07 2017
@@ -1335,6 +1335,12 @@ bool XMLReader::setEncoding(const XMLCh*
fMemoryManager->deallocate(fEncodingStr);
fEncodingStr = inputEncoding;
+ // Check for a pre-created transcoder to delete.
+ if (fTranscoder) {
+ delete fTranscoder;
+ fTranscoder = 0;
+ }
+
XMLTransService::Codes failReason;
fTranscoder = XMLPlatformUtils::fgTransService->makeNewTranscoderFor
(
@@ -1343,6 +1349,9 @@ bool XMLReader::setEncoding(const XMLCh*
, kCharBufSize
, fMemoryManager
);
+
+ if (!fTranscoder)
+ ThrowXMLwithMemMgr1(TranscodingException, XMLExcepts::Trans_CantCreateCvtrFor, fEncodingStr, fMemoryManager);
}
else
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org