aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/robot.cpp
diff options
context:
space:
mode:
authorLars Skovlund2011-02-02 21:05:38 +0000
committerLars Skovlund2011-02-02 21:05:38 +0000
commit441c5e02111461e901f1f886f62e63f3afb131e3 (patch)
treee7e0a31982ef926e6946ebe990116a23d05b3c30 /engines/sci/graphics/robot.cpp
parentb9b8b4d3eb9cdd280bf0c1162a93087e4cb8f876 (diff)
downloadscummvm-rg350-441c5e02111461e901f1f886f62e63f3afb131e3.tar.gz
scummvm-rg350-441c5e02111461e901f1f886f62e63f3afb131e3.tar.bz2
scummvm-rg350-441c5e02111461e901f1f886f62e63f3afb131e3.zip
SCI: Fix memory leaks in GfxRobot
svn-id: r55740
Diffstat (limited to 'engines/sci/graphics/robot.cpp')
-rw-r--r--engines/sci/graphics/robot.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/engines/sci/graphics/robot.cpp b/engines/sci/graphics/robot.cpp
index c9191c6f8e..a058761cf8 100644
--- a/engines/sci/graphics/robot.cpp
+++ b/engines/sci/graphics/robot.cpp
@@ -68,10 +68,7 @@ GfxRobot::GfxRobot(ResourceManager *resMan, GfxScreen *screen, GfxPalette *palet
}
GfxRobot::~GfxRobot() {
- delete[] _resourceData;
- delete[] _imageStart;
- delete[] _audioStart;
- delete[] _audioLen;
+ freeData();
}
void GfxRobot::init(GuiResourceId resourceId, uint16 x, uint16 y) {
@@ -174,6 +171,7 @@ void GfxRobot::drawNextFrame() {
if (_curFrame == _frameCount) {
// End of robot video, restore palette
g_system->setPalette(_savedPal, 0, 256);
+ freeData();
_resourceId = -1;
}
}
@@ -302,7 +300,13 @@ void GfxRobot::playAudio() {
}
}
-
+void GfxRobot::freeData()
+{
+ delete[] _resourceData; _resourceData = 0;
+ delete[] _imageStart; _imageStart = 0;
+ delete[] _audioStart; _audioStart = 0;
+ delete[] _audioLen; _audioLen = 0;
+}
#endif
} // End of namespace Sci