diff options
author | Paul Gilbert | 2015-01-19 10:51:05 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-01-19 10:51:05 -0500 |
commit | 83442b9586e3992ab8ee0f0d06e534781f9b448b (patch) | |
tree | 88cac87bedd0536ad48da40b2ea22e234d65614b | |
parent | f46b9d77dd1427aacb095f834f10f3fb45502637 (diff) | |
download | scummvm-rg350-83442b9586e3992ab8ee0f0d06e534781f9b448b.tar.gz scummvm-rg350-83442b9586e3992ab8ee0f0d06e534781f9b448b.tar.bz2 scummvm-rg350-83442b9586e3992ab8ee0f0d06e534781f9b448b.zip |
XEEN: Fix Valgrind warnings
-rw-r--r-- | engines/xeen/files.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/map.cpp | 14 | ||||
-rw-r--r-- | engines/xeen/sprites.cpp | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/engines/xeen/files.cpp b/engines/xeen/files.cpp index f15a08b184..f8e7a3fc0c 100644 --- a/engines/xeen/files.cpp +++ b/engines/xeen/files.cpp @@ -175,7 +175,7 @@ Common::SeekableReadStream *CCArchive::createReadStreamForMember(const Common::S // Read in the data for the specific resource f.seek(ccEntry._offset); - byte *data = new byte[ccEntry._size]; + byte *data = (byte *)malloc(ccEntry._size); f.read(data, ccEntry._size); if (_encoded) { diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index 9c69106857..99fe5ada0b 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -954,28 +954,28 @@ void Map::load(int mapId) { // Iterate through loading the given maze as well as the two successive // mazes in each of the four cardinal directions bool isDarkCc = _vm->getGameID() == GType_DarkSide; - MazeData *mazeData = &_mazeData[0]; + MazeData *mazeDataP = &_mazeData[0]; bool textLoaded = false; - for (int idx = 0; idx < 9; ++idx, ++mazeData) { - mazeData->_mazeId = mapId; + for (int idx = 0; idx < 9; ++idx, ++mazeDataP) { + mazeDataP->_mazeId = mapId; if (mapId != 0) { // Load in the maze's data file Common::String datName = Common::String::format("maze%c%03d.dat", (mapId >= 100) ? 'x' : '0', mapId); File datFile(datName); - mazeData->synchronize(datFile); + mazeDataP->synchronize(datFile); datFile.close(); if (isDarkCc && mapId == 50) - mazeData->setAllTilesStepped(); + mazeDataP->setAllTilesStepped(); if (!isDarkCc && _vm->_party._gameFlags[25] && (mapId == 42 || mapId == 43 || mapId == 4)) { - mazeData->clearCellSurfaces(); + mazeDataP->clearCellSurfaces(); } - _isOutdoors = (mazeData->_mazeFlags2 & FLAG_IS_OUTDOORS) != 0; + _isOutdoors = (mazeDataP->_mazeFlags2 & FLAG_IS_OUTDOORS) != 0; // Handle loading text data if (!textLoaded) { diff --git a/engines/xeen/sprites.cpp b/engines/xeen/sprites.cpp index 8ddf4ed48d..448ec0ec57 100644 --- a/engines/xeen/sprites.cpp +++ b/engines/xeen/sprites.cpp @@ -120,7 +120,7 @@ void SpriteResource::drawOffset(XSurface &dest, uint16 offset, const Common::Poi if (lineLength == 0) { // Skip the specified number of scan lines yPos += f.readByte(); - } else if ((destPos.y + yPos) < 0) { + } else if ((destPos.y + yPos) < 0 || (destPos.y + yPos) >= dest.h) { // Skip over the bytes of the line f.skip(lineLength); } else { |