From 52ecbd4305d2f728ea8db11dab28e9a56c9dcb6e Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 10 Nov 2010 06:22:18 +0000 Subject: 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 --- engines/toon/hotspot.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'engines/toon/hotspot.cpp') 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 -- cgit v1.2.3