I'm getting a large memory leak in my code, its even causing my program to shutdown after a little bit and I'm having trouble finding what is wrong. I ran rational purifyplus on it and it gave me the distinct location but I don't see the problem. Here's some code:
Calling Code:
GetMACAddress: (where the memory leak supposedly happens)Code:std::string str = ""; str += ZPacketData->GetData()->back()->GetMACAddress(TRUE);
The code is pretty straightforward and I'm assuming it has something to do with std::string. Also, PurifyPlus is stating that the leak is on the heap, but I didn't allocated anything to the heap except for m_Data. Any Ideas?Code:std::string ZeroPacket::GetMACAddress(BOOL IsSource) { std::string strReturn = ""; char cBuff[20]; char* pChar; if( IsSource ) pChar = (char*)(m_Data); else pChar = (char*)(m_Data+6); for( int i=0; i<6; i++ ) { sprintf(cBuff, ("02x:"), *(BYTE*)pChar++); strReturn += cBuff; } return strReturn; }



LinkBack URL
About LinkBacks


