[Scummvm-cvs-logs] scummvm master -> ec999f1cb74dff8c42c69898bb6cbc3823b169dd
bluegr
bluegr at gmail.com
Thu Apr 9 12:45:47 CEST 2015
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ec999f1cb7 MADS: Plug some memory leaks
Commit: ec999f1cb74dff8c42c69898bb6cbc3823b169dd
https://github.com/scummvm/scummvm/commit/ec999f1cb74dff8c42c69898bb6cbc3823b169dd
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-04-09T13:44:39+03:00
Commit Message:
MADS: Plug some memory leaks
Surfaces should be freed (to free their inner allocated surface
buffers) before being deleted
Changed paths:
engines/mads/game.cpp
engines/mads/nebular/dialogs_nebular.cpp
engines/mads/scene_data.cpp
engines/mads/sprites.cpp
engines/mads/user_interface.cpp
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp
index 72d7988..3d1c194 100644
--- a/engines/mads/game.cpp
+++ b/engines/mads/game.cpp
@@ -100,6 +100,7 @@ Game::~Game() {
}
delete _saveFile;
+ _surface->free();
delete _surface;
delete _sectionHandler;
}
diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp
index 1071579..5b9942d 100644
--- a/engines/mads/nebular/dialogs_nebular.cpp
+++ b/engines/mads/nebular/dialogs_nebular.cpp
@@ -430,7 +430,7 @@ void CopyProtectionDialog::show() {
draw();
Common::KeyState curKey;
- Common::Rect inputArea(110, 165, 210, 175);
+ const Common::Rect inputArea(110, 165, 210, 175);
MSurface *origInput = new MSurface(inputArea.width(), inputArea.height());
_vm->_screen.frameRect(inputArea, TEXTDIALOG_BLACK);
_vm->_screen.copyTo(origInput, inputArea, Common::Point(0, 0));
@@ -471,6 +471,7 @@ void CopyProtectionDialog::show() {
_vm->_screen.updateScreen();
}
+ origInput->free();
delete origInput;
}
@@ -592,6 +593,7 @@ void PictureDialog::save() {
void PictureDialog::restore() {
if (_savedSurface) {
_savedSurface->copyTo(&_vm->_screen);
+ _savedSurface->free();
delete _savedSurface;
_savedSurface = nullptr;
diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp
index d0e96be..e594406 100644
--- a/engines/mads/scene_data.cpp
+++ b/engines/mads/scene_data.cpp
@@ -451,6 +451,8 @@ void SceneInfo::loadMadsV2Background(int sceneId, const Common::String &resName,
fab.decompress(compressedTileData, compressedTileDataSize, (byte*)newTile->getPixels(), tileWidth * tileHeight);
tileSet.push_back(TileSetList::value_type(newTile));
+ newTile->free();
+ delete newTile;
delete[] compressedTileData;
}
diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp
index bc36b55..f15d645 100644
--- a/engines/mads/sprites.cpp
+++ b/engines/mads/sprites.cpp
@@ -347,8 +347,10 @@ void SpriteSlots::drawSprites(MSurface *s) {
spr->copyTo(s, Common::Point(xp, yp), sprite->getTransparencyIndex());
// Free sprite if it was a flipped one
- if (flipped)
+ if (flipped) {
+ spr->free();
delete spr;
+ }
}
}
}
diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp
index 93a555d..1e5a1d8 100644
--- a/engines/mads/user_interface.cpp
+++ b/engines/mads/user_interface.cpp
@@ -164,6 +164,7 @@ void UISlots::draw(bool updateFlag, bool delFlag) {
MSurface *spr = sprite->flipHorizontal();
userInterface.mergeFrom(spr, spr->getBounds(), slot._position,
sprite->getTransparencyIndex());
+ spr->free();
delete spr;
} else {
userInterface.mergeFrom(sprite, sprite->getBounds(), slot._position,
More information about the Scummvm-git-logs
mailing list