Fix memory leak in readGamePcText()

svn-id: r22133
This commit is contained in:
Travis Howell 2006-04-24 06:02:47 +00:00
parent 1fa5c82301
commit f08ed105e9
3 changed files with 6 additions and 6 deletions

View file

@ -253,16 +253,14 @@ void SimonEngine::loadGamePcFile() {
} }
void SimonEngine::readGamePcText(Common::File *in) { void SimonEngine::readGamePcText(Common::File *in) {
byte *text_mem;
_textSize = in->readUint32BE(); _textSize = in->readUint32BE();
text_mem = (byte *)malloc(_textSize); _textMem = (byte *)malloc(_textSize);
if (text_mem == NULL) if (_textMem == NULL)
error("Out of text memory"); 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) { void SimonEngine::readItemFromGamePc(Common::File *in, Item *item) {

View file

@ -580,6 +580,7 @@ SimonEngine::~SimonEngine() {
free(_stringTabPtr); free(_stringTabPtr);
free(_strippedTxtMem); free(_strippedTxtMem);
free(_tblList); free(_tblList);
free(_textMem);
free(_backGroundBuf); free(_backGroundBuf);
free(_frontBuf); free(_frontBuf);

View file

@ -203,6 +203,7 @@ protected:
Common::File *_gameFile; Common::File *_gameFile;
byte *_strippedTxtMem; byte *_strippedTxtMem;
byte *_textMem;
uint _textSize; uint _textSize;
uint _stringTabNum, _stringTabPos, _stringtab_numalloc; uint _stringTabNum, _stringTabPos, _stringtab_numalloc;
byte **_stringTabPtr; byte **_stringTabPtr;