You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by wh...@apache.org on 2004/10/15 16:47:06 UTC

cvs commit: ws-axis/c/src/engine/client Stub.cpp

whitlock    2004/10/15 07:47:06

  Modified:    c/src/engine/client Stub.cpp
  Log:
  Fix storage leak and initialise the attribute iterator properly
  
  Revision  Changes    Path
  1.18      +14 -5     ws-axis/c/src/engine/client/Stub.cpp
  
  Index: Stub.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/engine/client/Stub.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Stub.cpp	30 Aug 2004 09:43:44 -0000	1.17
  +++ Stub.cpp	15 Oct 2004 14:47:06 -0000	1.18
  @@ -51,6 +51,10 @@
       m_pCall = new Call();
       m_pCall->setProtocol(eProtocol);
       m_pCall->setEndpointURI(pcEndPointUri);
  +
  +	// Initialise m_viCurrentSOAPMethodAttribute to something sensible 
  +	// in case getFirstSOAPMethodAttribute isn't called first.
  +    m_viCurrentSOAPMethodAttribute = m_vSOAPMethodAttributes.begin();
   }
   
   Stub::~Stub()
  @@ -161,6 +165,8 @@
           {
                if(uiCount == uiOccurance)
                {
  +				 free(*currentKey);
  +				 free(*currentValue);
                    m_vKeys.erase(currentKey);
                    m_vValues.erase(currentValue);
                }
  @@ -296,6 +302,7 @@
   
       pAttribute = new Attribute(pLocalname, pPrefix, pValue);
       m_vSOAPMethodAttributes.push_back(pAttribute);
  +    m_viCurrentSOAPMethodAttribute = m_vSOAPMethodAttributes.begin();
   }
   
   Attribute* Stub::getFirstSOAPMethodAttribute()
  @@ -337,10 +344,10 @@
   	pSerializer = m_pCall->getSOAPSerializer();
       if (pSerializer)
       {
  -	for (unsigned int i = 0; i < m_vSOAPMethodAttributes.size(); i++)
  -	{
  -		pSerializer->setSOAPMethodAttribute(m_vSOAPMethodAttributes[i]->clone());
  -	}
  +       for (unsigned int i = 0; i < m_vSOAPMethodAttributes.size(); i++)
  +	   {
  +           pSerializer->setSOAPMethodAttribute(m_vSOAPMethodAttributes[i]->clone());
  +	   }
       }	
   }
   
  @@ -350,7 +357,7 @@
       {
           delete(*m_viCurrentSOAPMethodAttribute);
           m_vSOAPMethodAttributes.erase(m_viCurrentSOAPMethodAttribute);
  -
  +        m_viCurrentSOAPMethodAttribute = m_vSOAPMethodAttributes.begin();
       }
   }
   
  @@ -364,6 +371,7 @@
           {
               delete (*currentSOAPMethodAttribute);
               m_vSOAPMethodAttributes.erase(currentSOAPMethodAttribute);
  +            m_viCurrentSOAPMethodAttribute = m_vSOAPMethodAttributes.begin();
               bDone = true;
           }
           currentSOAPMethodAttribute++;
  @@ -375,6 +383,7 @@
   {
       Attribute* pAttribute = new Attribute(pLocalname, pPrefix, pUri, pValue);
   	m_vSOAPMethodAttributes.push_back(pAttribute);
  +    m_viCurrentSOAPMethodAttribute = m_vSOAPMethodAttributes.begin();
   }
   
   void Stub::setTransportTimeout(const long lSeconds)