ILLUSIONS: Fix some memory leaks (#2106)

This commit is contained in:
Anubhab Ghosh 2020-02-29 23:45:32 +00:00 committed by GitHub
parent 9ce1d470be
commit 5ecd4b0bbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 0 deletions

View File

@ -1006,6 +1006,7 @@ Controls::Controls(IllusionsEngine *vm)
Controls::~Controls() {
delete _sequenceOpcodes;
destroyControls();
}
void Controls::placeBackgroundObject(BackgroundObject *backgroundObject) {

View File

@ -60,6 +60,10 @@ DuckmanSpecialCode::~DuckmanSpecialCode() {
delete _propertyTimers;
delete _inventory;
delete _credits;
for (SpecialCodeMap::iterator it = _specialCodeMap.begin(); it != _specialCodeMap.end(); ++it) {
delete (*it)._value;
}
}
typedef Common::Functor1Mem<OpCall&, void, DuckmanSpecialCode> SpecialCodeFunctionDM;

View File

@ -34,6 +34,7 @@ GamArchive::GamArchive(const char *filename)
GamArchive::~GamArchive() {
delete[] _groups;
delete _fd;
}
byte *GamArchive::readResource(uint32 sceneId, uint32 resId, uint32 &dataSize) {

View File

@ -43,6 +43,7 @@ void GameState::writeState(uint32 sceneId, uint32 threadId) {
writeStream->writeUint32LE(sceneId);
writeStream->writeUint32LE(threadId);
writeStateInternal(writeStream);
delete writeStream;
}
void GameState::read(Common::ReadStream *in) {

View File

@ -36,6 +36,7 @@ ScreenText::ScreenText(IllusionsEngine *vm)
}
ScreenText::~ScreenText() {
freeTextSurface();
}
void ScreenText::getTextInfoDimensions(WidthHeight &textInfoDimensions) {

View File

@ -344,4 +344,12 @@ bool ThreadList::isActiveThread(int msgNum) {
return false;
}
ThreadList::~ThreadList() {
Iterator it = _threads.begin();
while (it != _threads.end()) {
delete *it;
it = _threads.erase(it);
}
}
} // End of namespace Illusions

View File

@ -105,6 +105,7 @@ public:
void setThreadSceneId(uint32 threadId, uint32 sceneId);
uint32 getThreadSceneId(uint32 threadId);
bool isActiveThread(int msgNum);
~ThreadList();
protected:
typedef Common::List<Thread*> List;
typedef List::iterator Iterator;