You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by xe...@xml.apache.org on 2004/09/21 21:07:37 UTC

[jira] Closed: (XERCESC-1218) XSerializeEngine constructors are not exception-safe

Message:

   The following issue has been closed.

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XERCESC-1218

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XERCESC-1218
    Summary: XSerializeEngine constructors are not exception-safe
       Type: Bug

     Status: Closed
   Priority: Critical
 Resolution: FIXED

    Project: Xerces-C++
 Components: 
             Utilities
   Versions:
             Nightly build (please specify the date)

   Assignee: Neil Graham
   Reporter: David Bertoni

    Created: Wed, 19 May 2004 1:37 PM
    Updated: Tue, 21 Sep 2004 12:06 PM
Environment: All platforms

Description:
The constructors for XSerializeEngine can leak memory if the constructor body throws an exception.  Because the data members fBufStart, fStorePool, and fLoadPool are pointers, the objects and memory they point to will not be destroyed or deallocated if an exception is thrown.

One way to fix this would be to make the data members Janitor and ArrayJanitor instances.  Another would be to ensure the constructors don't throw any exceptions, or to use Janitors inside the constructor and release then when leaving the constrcutor.

I've created a proposed patch that does two things.  For the "loading" constructors, it simply removes the call to fillBuffer().  This seems to work fine, because all of the extraction routines will detect the buffer is empty and fill it before they do anything.  For the "storing" constructors, I've created some Janitors on the stack inside the constructor bodies.




---------------------------------------------------------------------
JIRA INFORMATION:
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

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org