[ 
https://issues.apache.org/jira/browse/XERCESC-1974?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Scott Cantor closed XERCESC-1974.
---------------------------------

Applied to 3.1 branch, r1662885

This is a modified patch with a local Janitor instance instead of the change to 
the member variable, to avoid an ABI change for the branch.

> Memory leak occurs if an exception is thrown in TranscodeToStr or 
> TranscodeFromStr constructors
> -----------------------------------------------------------------------------------------------
>
>                 Key: XERCESC-1974
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1974
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 3.1.1
>         Environment: Any
>            Reporter: Lee Doron
>            Assignee: Alberto Massari
>              Labels: patch
>             Fix For: 3.1.2, 3.2.0
>
>         Attachments: TransService.cpp.patch
>
>
> The constructor for TranscodeToStr calls TranscodeToStr::transcode(). That 
> method allocates memory for fString, but it is possible for an exception to 
> occur shortly thereafter; it might be thrown directly by transcode(), or by 
> the transcoder method call trans->transcodeTo(). Since we are still in the 
> constructor, TranscodeToStr's destructor will not be called during the stack 
> unwind to clean up (see 
> http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.10 ). Therefore, 
> we have to explicitly make sure fString will be deallocated. Since the 
> current code doesn't do that, it leaks memory. TranscodeFromStr is in the 
> same situation.
> I have a simple patch that I expect to post later tonight.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to