Delete old child elements in SOAPElement::operator=
Brought to you by:
gjpc
After clearing the old m_internalElements and assigning the new child elements you need to delete the old m_internalElements. Aren't they lost otherwise?
- // clear any old child elements
// get a copy of old internal elements to free them later
+ ElementContainer temp(m_internalElements);
m_internalElements.clear();
//Change on 07/03/2001 by SM
//Correct copy operator
for(int i=0;i<rhs.numElements();i++)
{
SOAPElement* pElement = new SOAPElement( *rhs.m_internalElements[i] );
addElement( pElement );
}
+ // free old internal elements
+ for(size_t i=0; i < temp.size(); ++i)
+ delete temp[i];