[Scummvm-cvs-logs] SF.net SVN: scummvm: [32673] scummvm/branches/gsoc2008-rtl/engines/saga

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Thu Jun 12 18:58:03 CEST 2008


Revision: 32673
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32673&view=rev
Author:   cpage88
Date:     2008-06-12 09:58:02 -0700 (Thu, 12 Jun 2008)

Log Message:
-----------
SAGA: Fixed memory leaks in the SAGA engine

Modified Paths:
--------------
    scummvm/branches/gsoc2008-rtl/engines/saga/animation.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/font.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/interface.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/interface.h
    scummvm/branches/gsoc2008-rtl/engines/saga/introproc_ihnm.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/rscfile.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/saga.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/saga.h
    scummvm/branches/gsoc2008-rtl/engines/saga/script.cpp
    scummvm/branches/gsoc2008-rtl/engines/saga/sprite.cpp

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/animation.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/animation.cpp	2008-06-12 12:16:50 UTC (rev 32672)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/animation.cpp	2008-06-12 16:58:02 UTC (rev 32673)
@@ -55,6 +55,7 @@
 
 Anim::~Anim(void) {
 	reset();
+	freeCutawayList();
 }
 
 void Anim::loadCutawayList(const byte *resourcePointer, size_t resourceLength) {

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/font.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/font.cpp	2008-06-12 12:16:50 UTC (rev 32672)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/font.cpp	2008-06-12 16:58:02 UTC (rev 32673)
@@ -63,6 +63,8 @@
 
 		free(_fonts[i]);
 	}
+
+	free(_fonts);
 }
 
 

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/interface.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/interface.cpp	2008-06-12 12:16:50 UTC (rev 32672)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/interface.cpp	2008-06-12 16:58:02 UTC (rev 32673)
@@ -334,7 +334,21 @@
 Interface::~Interface(void) {
 	free(_inventory);
 
+	free(_mainPanel.image);
+	free(_conversePanel.image);
+	free(_optionPanel.image);
+	free(_quitPanel.image);
+	free(_loadPanel.image);
+	free(_savePanel.image);
+
 	_mainPanel.sprites.freeMem();
+	_conversePanel.sprites.freeMem();
+	_optionPanel.sprites.freeMem();
+	_quitPanel.sprites.freeMem();
+	_loadPanel.sprites.freeMem();
+	_savePanel.sprites.freeMem();
+	_protectPanel.sprites.freeMem();
+
 	_defPortraits.freeMem();
 	_scenePortraits.freeMem();
 }

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/interface.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/interface.h	2008-06-12 12:16:50 UTC (rev 32672)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/interface.h	2008-06-12 16:58:02 UTC (rev 32673)
@@ -112,7 +112,11 @@
 		buttonsCount = 0;
 		buttons = NULL;
 	}
-
+/*
+	~InterfacePanel() {
+		sprites.freeMem();
+	}
+*/
 	PanelButton *getButton(int index) {
 		if ((index >= 0) && (index < buttonsCount)) {
 			return &buttons[index];

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/introproc_ihnm.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/introproc_ihnm.cpp	2008-06-12 12:16:50 UTC (rev 32672)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/introproc_ihnm.cpp	2008-06-12 16:58:02 UTC (rev 32673)
@@ -132,6 +132,8 @@
 
 	// Load the cutaways for the title screens
 	_vm->_anim->loadCutawayList(resourcePointer, resourceLength);
+
+	free(resourcePointer);
 }
 
 bool Scene::checkKey() {

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/rscfile.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/rscfile.cpp	2008-06-12 12:16:50 UTC (rev 32672)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/rscfile.cpp	2008-06-12 16:58:02 UTC (rev 32673)
@@ -769,6 +769,7 @@
 	_vm->_sprite->_mainSprites.freeMem();
 	_vm->_sprite->loadList(_metaResource.mainSpritesID, _vm->_sprite->_mainSprites);
 
+
 	_vm->_actor->loadObjList(_metaResource.objectCount, _metaResource.objectsResourceID);
 
 	_vm->_resource->loadResource(resourceContext, _metaResource.cutawayListResourceID, resourcePointer, resourceLength);
@@ -806,6 +807,7 @@
 		// The IHNM demo has a fixed music track and doesn't load a song table
 		_vm->_music->setVolume(_vm->_musicVolume == 10 ? -1 : _vm->_musicVolume * 25, 1);
 		_vm->_music->play(3, MUSIC_LOOP);
+		free(resourcePointer);
 	}
 
 	int voiceLUTResourceID = 0;

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/saga.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/saga.cpp	2008-06-12 12:16:50 UTC (rev 32672)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/saga.cpp	2008-06-12 16:58:02 UTC (rev 32673)
@@ -79,6 +79,7 @@
 	_scene = NULL;
 	_isoMap = NULL;
 	_gfx = NULL;
+	_driver = NULL;
 	_console = NULL;
 	_render = NULL;
 	_music = NULL;
@@ -133,6 +134,7 @@
 	delete _render;
 	delete _music;
 	delete _sound;
+	delete _driver;
 	delete _gfx;
 	delete _console;
 
@@ -188,11 +190,11 @@
 	bool native_mt32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
 	bool adlib = (midiDriver == MD_ADLIB);
 
-	MidiDriver *driver = MidiDriver::createMidi(midiDriver);
+	_driver = MidiDriver::createMidi(midiDriver);
 	if (native_mt32)
-		driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
+		_driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
 
-	_music = new Music(this, _mixer, driver, _musicVolume);
+	_music = new Music(this, _mixer, _driver, _musicVolume);
 	_music->setNativeMT32(native_mt32);
 	_music->setAdlib(adlib);
 

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/saga.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/saga.h	2008-06-12 12:16:50 UTC (rev 32672)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/saga.h	2008-06-12 16:58:02 UTC (rev 32673)
@@ -29,6 +29,7 @@
 #include "engines/engine.h"
 
 #include "common/stream.h"
+#include "sound/mididrv.h"
 
 #include "saga/gfx.h"
 #include "saga/list.h"
@@ -531,6 +532,7 @@
 	SndRes *_sndRes;
 	Sound *_sound;
 	Music *_music;
+	MidiDriver *_driver;
 	Anim *_anim;
 	Render *_render;
 	IsoMap *_isoMap;

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/script.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/script.cpp	2008-06-12 12:16:50 UTC (rev 32672)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/script.cpp	2008-06-12 16:58:02 UTC (rev 32673)
@@ -150,6 +150,7 @@
 	debug(8, "Shutting down scripting subsystem.");
 
 	_mainStrings.freeMem();
+	_globalVoiceLUT.freeMem();
 
 	freeModules();
 	free(_modules);

Modified: scummvm/branches/gsoc2008-rtl/engines/saga/sprite.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/saga/sprite.cpp	2008-06-12 12:16:50 UTC (rev 32672)
+++ scummvm/branches/gsoc2008-rtl/engines/saga/sprite.cpp	2008-06-12 16:58:02 UTC (rev 32673)
@@ -74,6 +74,9 @@
 Sprite::~Sprite(void) {
 	debug(8, "Shutting down sprite subsystem...");
 	_mainSprites.freeMem();
+	_inventorySprites.freeMem();
+	_arrowSprites.freeMem();
+	_saveReminderSprites.freeMem();
 	free(_decodeBuf);
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list