diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-05-04 15:15:10 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-05-04 15:15:10 +0200 |
commit | 0d1804e439ec0028be4d5380e66c13481781fc57 (patch) | |
tree | 95d4c3ab397568f36832cf27cf98c351e9d22e4d /src/WorldStorage/WSSCompact.cpp | |
parent | Fixed lever and button powering direction (diff) | |
parent | Fixed pressure plate oversights (diff) | |
download | cuberite-0d1804e439ec0028be4d5380e66c13481781fc57.tar cuberite-0d1804e439ec0028be4d5380e66c13481781fc57.tar.gz cuberite-0d1804e439ec0028be4d5380e66c13481781fc57.tar.bz2 cuberite-0d1804e439ec0028be4d5380e66c13481781fc57.tar.lz cuberite-0d1804e439ec0028be4d5380e66c13481781fc57.tar.xz cuberite-0d1804e439ec0028be4d5380e66c13481781fc57.tar.zst cuberite-0d1804e439ec0028be4d5380e66c13481781fc57.zip |
Diffstat (limited to 'src/WorldStorage/WSSCompact.cpp')
-rw-r--r-- | src/WorldStorage/WSSCompact.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/WorldStorage/WSSCompact.cpp b/src/WorldStorage/WSSCompact.cpp index c07c9e96f..359bac4a8 100644 --- a/src/WorldStorage/WSSCompact.cpp +++ b/src/WorldStorage/WSSCompact.cpp @@ -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 |