Fix leak of map data when extracting map from demo fails

This commit is contained in:
Robert Müller 2023-07-26 15:32:58 +02:00
parent fd13ae5fd5
commit 4233574085

View file

@ -882,7 +882,10 @@ bool CDemoPlayer::ExtractMap(class IStorage *pStorage)
// save map
IOHANDLE MapFile = pStorage->OpenFile(aMapFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE);
if(!MapFile)
{
free(pMapData);
return false;
}
io_write(MapFile, pMapData, m_MapInfo.m_Size);
io_close(MapFile);