axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject cvs commit: ws-axis/c/src/engine/client Call.cpp
Date Mon, 17 Jan 2005 02:51:20 GMT
samisa      2005/01/16 18:51:20

  Modified:    c/src/engine/client Call.cpp
  Log:
  Fixes to make sure memory cleanup in case of an exception. If initialize has been called,
ensure a matching uninitialize
  
  Revision  Changes    Path
  1.92      +16 -3     ws-axis/c/src/engine/client/Call.cpp
  
  Index: Call.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/engine/client/Call.cpp,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- Call.cpp	14 Jan 2005 13:42:19 -0000	1.91
  +++ Call.cpp	17 Jan 2005 02:51:19 -0000	1.92
  @@ -54,7 +54,8 @@
   bool CallBase::bInitialized = false;
   
   Call::Call ()
  -:m_pcEndPointUri(NULL), m_strProxyHost(""), m_uiProxyPort(0), m_bUseProxy(false), m_bModuleInitialized(false)
  +:m_pcEndPointUri(NULL), m_strProxyHost(""), m_uiProxyPort(0), m_bUseProxy(false), m_bModuleInitialized(false),
  +m_bCallInitialized(false)
   {
       m_pAxisEngine = NULL;
       m_pIWSSZ = NULL;
  @@ -74,12 +75,21 @@
   
   Call::~Call ()
   {
  -	    SOAPTransportFactory::destroyTransportObject(m_pTransport);
  +    // Samisa: we have to cover the case of initialize has been called
  +    // but no matching unitialize. We have to ensure memory deallocation when
  +    // there is an exception, after initialize has been called.
  +    // could have been coverd though a matching call to uninitialize within 
  +    // generated code, but it is easier to cover it here
  +    // because it requires a lengthy conditional block to cover all cases
  +    // in generated code
  +     if (m_bCallInitialized) 
  +        unInitialize();
  +	 SOAPTransportFactory::destroyTransportObject(m_pTransport);
   		m_pTransport = NULL;
       if (m_bModuleInitialized)
           uninitialize_module();
       if (m_pcEndPointUri)
  -        delete [] m_pcEndPointUri;
  +        delete [] m_pcEndPointUri;   
   }
   
   int Call::setEndpointURI (const char* pchEndpointURI)
  @@ -153,6 +163,8 @@
    * client side handlers have the same PROVIDERTYPE ? 
    */
   {
  +    m_bCallInitialized = true;
  +
       /* Initialize re-usable objects of this instance (objects may have been 
        * populated by the previous call.)
        */
  @@ -242,6 +254,7 @@
   
   int Call::unInitialize ()
   {
  +    m_bCallInitialized = false;
       if (m_pAxisEngine)
       {
   		/* Initialization,serialization, invokation or check message success */
  
  
  

Mime
View raw message