1
0

Fix for minor resource leak (CID 43616)

This commit is contained in:
jfhumann 2014-04-26 00:43:01 +02:00
parent 03402efc49
commit c8d5fcfffa

View File

@ -468,7 +468,15 @@ cWSSCompact::cPAKFile::cPAKFile(const AString & a_FileName, int a_LayerX, int a_
for (int i = 0; i < NumChunks; i++)
{
sChunkHeader * Header = new sChunkHeader;
READ(*Header);
// Here we do not use the READ macro, as it does not free the resources
// allocated with new in case of error.
if (f.Read(Header, sizeof(*Header)) != sizeof(*Header))
{
LOGERROR("ERROR READING %s FROM FILE %s (line %d); file offset %d", "Header", m_FileName.c_str(), __LINE__, f.Tell());
delete Header;
return;
}
m_ChunkHeaders.push_back(Header);
} // for i - chunk headers