Skip to content

Commit

Permalink
WAGE: Plugged even more memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Jan 6, 2016
1 parent 07642d2 commit 4d3707d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion engines/wage/design.cpp
Expand Up @@ -75,7 +75,8 @@ Design::Design(Common::SeekableReadStream *data) {

Design::~Design() {
free(_data);
_surface->free();
if (_surface && _surface->getPixels())
_surface->free();
delete _surface;
}

Expand Down
3 changes: 3 additions & 0 deletions engines/wage/entities.cpp
Expand Up @@ -234,6 +234,9 @@ Obj::Obj(String name, Common::SeekableReadStream *data) {
delete data;
}

Obj::~Obj() {
}

Chr *Obj::removeFromChr() {
if (_currentOwner != NULL) {
for (int i = (int)_currentOwner->_inventory.size() - 1; i >= 0; i--)
Expand Down
1 change: 1 addition & 0 deletions engines/wage/entities.h
Expand Up @@ -315,6 +315,7 @@ class Obj : public Weapon, public Designed {
public:
Obj() : _currentOwner(NULL), _currentScene(NULL) {}
Obj(String name, Common::SeekableReadStream *data);
~Obj();

enum ObjectType {
REGULAR_WEAPON = 1,
Expand Down
3 changes: 3 additions & 0 deletions engines/wage/world.cpp
Expand Up @@ -363,9 +363,12 @@ Common::String *World::loadStringFromDITL(Common::MacResManager *resMan, int res
Common::String message = readPascalString(res);
if (i == itemIndex) {
Common::String *msg = new Common::String(message);
delete res;
return msg;
}
}

delete res;
}

return NULL;
Expand Down

0 comments on commit 4d3707d

Please sign in to comment.