axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Linine (JIRA)" <axis-c-...@ws.apache.org>
Subject [jira] Created: (AXISCPP-816) Problems in Call::Call () - src\engine\client\Call.cpp file
Date Fri, 26 Aug 2005 21:04:30 GMT
Problems in Call::Call () - src\engine\client\Call.cpp file
-----------------------------------------------------------

         Key: AXISCPP-816
         URL: http://issues.apache.org/jira/browse/AXISCPP-816
     Project: Axis-C++
        Type: Bug
  Components: Client - Engine  
    Versions: current (nightly)    
 Reporter: Denis Linine
    Priority: Minor


There is a couple of problems with the Call::Call ()  (code below) implementation.

Call::Call ()
:m_pcEndPointUri(NULL), m_strProxyHost(""), m_uiProxyPort(0), m_bUseProxy(false),
m_bCallInitialized(false)
{
    m_pAxisEngine = NULL;
    m_pIWSSZ = NULL;
    m_pIWSDZ = NULL;
    initialize_module (0);
    
    m_pTransport = NULL;
    m_nTransportType = APTHTTP1_1;
    
    m_nStatus = AXIS_SUCCESS;
    m_pchSessionID = NULL;
	m_pContentIdSet = new ContentIdSet();

    // Setup Transport
    try
    {
        // Get a transport object from factory
        if( !m_pTransport)
		{
            m_pTransport = SOAPTransportFactory::getTransportObject(m_nTransportType);

			if( !m_pTransport)
			{
				m_nStatus = AXIS_FAIL;
			}
		}

        // Engine initialization
        m_pAxisEngine = new ClientAxisEngine ();
        if (!m_pAxisEngine) 
        {
        	m_nStatus = AXIS_FAIL;
        }
        m_nStatus = m_pAxisEngine->initialize ();

    }
    catch( AxisException& e)
    {
		char *	pszError = new char[strlen( e.what()) + 1];
		strcpy( pszError, e.what());

		throw AxisGenException( e.getExceptionCode(), const_cast<char*>(pszError));
    }
    catch(...)
    {
        throw;
    }
}


the most obvious one is that the pszError in the catch( AxisException& e) leaks.

one could write that code like this
 catch( AxisException& e)
  {
       throw AxisGenException( e.getExceptionCode(),  e.what());
  }

The second problem is that if an exception is thrown from the constructor  - the destructor
will not be called. This means that if an exception is thrown - the
memory pointed by m_pContentIdSet will leak  always, m_pTransport will never be destroyed
 and memory pointed by m_pAxisEngine will leak if the execution went so far that it was allocated.




-- 
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


Mime
View raw message