diff options
author | Travis Howell | 2006-04-24 06:02:47 +0000 |
---|---|---|
committer | Travis Howell | 2006-04-24 06:02:47 +0000 |
commit | f08ed105e96e5a41bcbda55d2a83586b87e98b1b (patch) | |
tree | 9b867121660067fd074d67de4a8ef51f4eea8e43 /engines | |
parent | 1fa5c82301b49972ab23a5f4e11063977cb77f7d (diff) | |
download | scummvm-rg350-f08ed105e96e5a41bcbda55d2a83586b87e98b1b.tar.gz scummvm-rg350-f08ed105e96e5a41bcbda55d2a83586b87e98b1b.tar.bz2 scummvm-rg350-f08ed105e96e5a41bcbda55d2a83586b87e98b1b.zip |
Fix memory leak in readGamePcText()
svn-id: r22133
Diffstat (limited to 'engines')
-rw-r--r-- | engines/simon/res.cpp | 10 | ||||
-rw-r--r-- | engines/simon/simon.cpp | 1 | ||||
-rw-r--r-- | engines/simon/simon.h | 1 |
3 files changed, 6 insertions, 6 deletions
diff --git a/engines/simon/res.cpp b/engines/simon/res.cpp index 103eb772af..a2c25f3ef7 100644 --- a/engines/simon/res.cpp +++ b/engines/simon/res.cpp @@ -253,16 +253,14 @@ void SimonEngine::loadGamePcFile() { } 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) { diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp index 79860bb251..552b828736 100644 --- a/engines/simon/simon.cpp +++ b/engines/simon/simon.cpp @@ -580,6 +580,7 @@ SimonEngine::~SimonEngine() { free(_stringTabPtr); free(_strippedTxtMem); free(_tblList); + free(_textMem); free(_backGroundBuf); free(_frontBuf); diff --git a/engines/simon/simon.h b/engines/simon/simon.h index 799a663098..70e667a3d2 100644 --- a/engines/simon/simon.h +++ b/engines/simon/simon.h @@ -203,6 +203,7 @@ protected: Common::File *_gameFile; byte *_strippedTxtMem; + byte *_textMem; uint _textSize; uint _stringTabNum, _stringTabPos, _stringtab_numalloc; byte **_stringTabPtr; |