[Scummvm-cvs-logs] SF.net SVN: scummvm: [26483] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Apr 15 10:32:29 CEST 2007


Revision: 26483
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26483&view=rev
Author:   peres001
Date:     2007-04-15 01:32:28 -0700 (Sun, 15 Apr 2007)

Log Message:
-----------
Fixed some memory leaks.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/walk.cpp
    scummvm/trunk/engines/parallaction/zone.cpp
    scummvm/trunk/engines/parallaction/zone.h

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-04-15 05:33:21 UTC (rev 26482)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-04-15 08:32:28 UTC (rev 26483)
@@ -897,6 +897,9 @@
 
 	setBlackPalette();
 
+	_bgLayers[0] = _bgLayers[1] = _bgLayers[2] = _bgLayers[3] = 0;
+
+	memset(_palette, 0, sizeof(_palette));
 	memset(_palettefx, 0, sizeof(_palettefx));
 
 	initMouse( 0 );

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-04-15 05:33:21 UTC (rev 26482)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-04-15 08:32:28 UTC (rev 26483)
@@ -139,6 +139,8 @@
 
 	if (_localFlagNames)
 		delete _localFlagNames;
+
+	delete _gfx;
 }
 
 

Modified: scummvm/trunk/engines/parallaction/walk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/walk.cpp	2007-04-15 05:33:21 UTC (rev 26482)
+++ scummvm/trunk/engines/parallaction/walk.cpp	2007-04-15 08:32:28 UTC (rev 26483)
@@ -182,7 +182,7 @@
 	_list->insert(_list->begin(), _subPath.begin(), _subPath.end());
 
 	for (WalkNodeList::iterator it = _list->begin(); it != _list->end(); it++)
-		printf("node (%i, %i)\n", (*it)->_x, (*it)->_y);
+//		printf("node (%i, %i)\n", (*it)->_x, (*it)->_y);
 
 	delete v44;
 	return _list;

Modified: scummvm/trunk/engines/parallaction/zone.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/zone.cpp	2007-04-15 05:33:21 UTC (rev 26482)
+++ scummvm/trunk/engines/parallaction/zone.cpp	2007-04-15 08:32:28 UTC (rev 26483)
@@ -601,7 +601,7 @@
 }
 
 Zone::~Zone() {
-	printf("~Zone(%s)\n", _label._text);
+//	printf("~Zone(%s)\n", _label._text);
 
 	switch (_type & 0xFFFF) {
 	case kZoneExamine:
@@ -642,11 +642,6 @@
 	default:
 		break;
 	}
-
-	free(_label._text);
-	_label._text = NULL;
-	_vm->_gfx->freeStaticCnv(&_label._cnv);
-
 }
 
 void Zone::getRect(Common::Rect& r) const {
@@ -671,5 +666,15 @@
 	return _bottom - _top;
 }
 
+Label::Label() {
+	_text = NULL;
+}
 
+Label::~Label() {
+	_vm->_gfx->freeStaticCnv(&_cnv);
+	if (_text)
+		free(_text);
+}
+
+
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/zone.h
===================================================================
--- scummvm/trunk/engines/parallaction/zone.h	2007-04-15 05:33:21 UTC (rev 26482)
+++ scummvm/trunk/engines/parallaction/zone.h	2007-04-15 08:32:28 UTC (rev 26483)
@@ -184,9 +184,8 @@
 	char*			_text;
 	StaticCnv		_cnv;
 
-	Label() {
-		_text = NULL;
-	}
+	Label();
+	~Label();
 };
 
 struct Zone {


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