Is there any inherent memory leakage problem associated with tinyXML? I don't know why I am getting this strange seg fault. In the following function, whenever I try to increase the size of element name("Connecor" &"laneFro"), the following if clause(in the loop) causes the program to crash.
void WriteXMLInput_Node_Connectors(Node* node,TiXmlElement * Node_)
{
std::ostringstream out;
TiXmlElement * Connectors = new TiXmlElement("Connectors"); Node_->LinkEndChild(Connectors);
TiXmlElement * Connector;
TiXmlElement * laneFrom;
TiXmlElement * laneTo;
for(std::map<const sim_mob::Lane*, sim_mob::Lane* >::const_iterator it = node->getConnectors().begin();it != (node->getConnectors().end()); it++)
{
Connector = new TiXmlElement("Connecor"); Connectors->LinkEndChild(Connector);
laneFrom = new TiXmlElement("laneFro"); Connector->LinkEndChild(laneFrom);
// laneTo = new TiXmlElement("laneTo"); Connector->LinkEndChild(laneTo);
if(42792 == node->getID())
{
std::cout << "uninode " ;
std::cout << uninode->getID();
std::cout << " from: " << (*it).first << " ";
std::cout << (*it).first->getLaneID_str();
std::cout << "uninode " << uninode->getID() << " To: " << (*it).second->getLaneID_str();
}
}
Thank you