aboutsummaryrefslogtreecommitdiff
path: root/engines/toon/hotspot.cpp
diff options
context:
space:
mode:
authorDavid Turner2010-11-10 06:22:18 +0000
committerDavid Turner2010-11-10 06:22:18 +0000
commit52ecbd4305d2f728ea8db11dab28e9a56c9dcb6e (patch)
treec8d08f83e8014acfe70ac4f4798a8856d7e21624 /engines/toon/hotspot.cpp
parent7ad677afc8ad3768a8c903afed5881403e1a026d (diff)
downloadscummvm-rg350-52ecbd4305d2f728ea8db11dab28e9a56c9dcb6e.tar.gz
scummvm-rg350-52ecbd4305d2f728ea8db11dab28e9a56c9dcb6e.tar.bz2
scummvm-rg350-52ecbd4305d2f728ea8db11dab28e9a56c9dcb6e.zip
TOON: Even more corrections to close memory leaks.
These corrections close a number of leaks in the Toon engine reported by running Valgrind with --leak-check=full option, but a few still remain. svn-id: r54185
Diffstat (limited to 'engines/toon/hotspot.cpp')
-rw-r--r--engines/toon/hotspot.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/engines/toon/hotspot.cpp b/engines/toon/hotspot.cpp
index 782e49c2d5..687ea6ee83 100644
--- a/engines/toon/hotspot.cpp
+++ b/engines/toon/hotspot.cpp
@@ -29,11 +29,12 @@
namespace Toon {
Hotspots::Hotspots(ToonEngine *vm) : _vm(vm) {
- _items = 0;
+ _items = NULL;
_numItems = 0;
}
Hotspots::~Hotspots() {
+ delete[] _items;
}
void Hotspots::load(Common::ReadStream *Stream) {
@@ -49,7 +50,6 @@ void Hotspots::load(Common::ReadStream *Stream) {
}
void Hotspots::save(Common::WriteStream *Stream) {
-
Stream->writeSint16BE(_numItems);
for (int32 i = 0; i < _numItems; i++) {
@@ -123,9 +123,7 @@ bool Hotspots::LoadRif(Common::String rifName, Common::String additionalRifName)
_numItems = (rifsize + rifsize2) / 512;
- if (_items)
- delete[] _items;
-
+ delete[] _items;
_items = new HotspotData[_numItems];
// RIFs are compressed in RNC1