[Scummvm-cvs-logs] SF.net SVN: scummvm: [22133] scummvm/trunk/engines/simon
kirben at users.sourceforge.net
kirben at users.sourceforge.net
Sun Apr 23 23:03:04 CEST 2006
Revision: 22133
Author: kirben
Date: 2006-04-23 23:02:47 -0700 (Sun, 23 Apr 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=22133&view=rev
Log Message:
-----------
Fix memory leak in readGamePcText()
Modified Paths:
--------------
scummvm/trunk/engines/simon/res.cpp
scummvm/trunk/engines/simon/simon.cpp
scummvm/trunk/engines/simon/simon.h
Modified: scummvm/trunk/engines/simon/res.cpp
===================================================================
--- scummvm/trunk/engines/simon/res.cpp 2006-04-24 06:01:51 UTC (rev 22132)
+++ scummvm/trunk/engines/simon/res.cpp 2006-04-24 06:02:47 UTC (rev 22133)
@@ -253,16 +253,14 @@
}
void SimonEngine::readGamePcText(Common::File *in) {
- byte *text_mem;
-
_textSize = in->readUint32BE();
- text_mem = (byte *)malloc(_textSize);
- if (text_mem == NULL)
+ _textMem = (byte *)malloc(_textSize);
+ if (_textMem == NULL)
error("Out of text memory");
- in->read(text_mem, _textSize);
+ in->read(_textMem, _textSize);
- setupStringTable(text_mem, _stringTabNum);
+ setupStringTable(_textMem, _stringTabNum);
}
void SimonEngine::readItemFromGamePc(Common::File *in, Item *item) {
Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp 2006-04-24 06:01:51 UTC (rev 22132)
+++ scummvm/trunk/engines/simon/simon.cpp 2006-04-24 06:02:47 UTC (rev 22133)
@@ -580,6 +580,7 @@
free(_stringTabPtr);
free(_strippedTxtMem);
free(_tblList);
+ free(_textMem);
free(_backGroundBuf);
free(_frontBuf);
Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h 2006-04-24 06:01:51 UTC (rev 22132)
+++ scummvm/trunk/engines/simon/simon.h 2006-04-24 06:02:47 UTC (rev 22133)
@@ -203,6 +203,7 @@
Common::File *_gameFile;
byte *_strippedTxtMem;
+ byte *_textMem;
uint _textSize;
uint _stringTabNum, _stringTabPos, _stringtab_numalloc;
byte **_stringTabPtr;
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