HUGO: Close Two Memory Leaks.

Note that the first leak is the allocation of the Common::RandomSource, _rnd. I'm not sure of the effect of deallocating this while it is still registered to g_eventRec, but all other engines seem to be the same (or implicitly do this by making a Common::RandomSource member of the engine object) so this is not a engine specific issue, but should be assessed.

svn-id: r54659
This commit is contained in:
David Turner 2010-11-30 00:01:54 +00:00
parent 1fbd80b1e3
commit 27a3173d93
2 changed files with 7 additions and 0 deletions

View file

@ -81,6 +81,7 @@ HugoEngine::HugoEngine(OSystem *syst, const HugoGameDescription *gd) : Engine(sy
DebugMan.addDebugChannel(kDebugObject, "Object", "Object debug level");
_console = new HugoConsole(this);
_rnd = 0;
}
HugoEngine::~HugoEngine() {
@ -167,6 +168,7 @@ HugoEngine::~HugoEngine() {
DebugMan.clearAllDebugChannels();
delete _console;
delete _rnd;
}
GameType HugoEngine::getGameType() const {

View file

@ -343,7 +343,12 @@ bool ObjectHandler::findObjectSpace(object_t *obj, int16 *destx, int16 *desty) {
* Free ObjectArr (before exiting)
*/
void ObjectHandler::freeObjectArr() {
for(int16 i = 0; i < _objCount; i++) {
free(_objects[i].stateDataIndex);
_objects[i].stateDataIndex = 0;
}
free(_objects);
_objects = 0;
}
/**