Fix memory leak in readGamePcText()
svn-id: r22133
This commit is contained in:
parent
1fa5c82301
commit
f08ed105e9
3 changed files with 6 additions and 6 deletions
|
@ -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) {
|
||||
|
|
|
@ -580,6 +580,7 @@ SimonEngine::~SimonEngine() {
|
|||
free(_stringTabPtr);
|
||||
free(_strippedTxtMem);
|
||||
free(_tblList);
|
||||
free(_textMem);
|
||||
|
||||
free(_backGroundBuf);
|
||||
free(_frontBuf);
|
||||
|
|
|
@ -203,6 +203,7 @@ protected:
|
|||
Common::File *_gameFile;
|
||||
|
||||
byte *_strippedTxtMem;
|
||||
byte *_textMem;
|
||||
uint _textSize;
|
||||
uint _stringTabNum, _stringTabPos, _stringtab_numalloc;
|
||||
byte **_stringTabPtr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue