aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-01-07 00:51:14 +0100
committerEugene Sandulenko2016-01-07 00:51:14 +0100
commit4d3707d7956352acb69f05e45084ee1964a2577f (patch)
tree4bf41beb4fa757130a9575b684b3afb9bb60a457 /engines
parent07642d291e7ced77a367ec9a91fa390e7c86e6e4 (diff)
downloadscummvm-rg350-4d3707d7956352acb69f05e45084ee1964a2577f.tar.gz
scummvm-rg350-4d3707d7956352acb69f05e45084ee1964a2577f.tar.bz2
scummvm-rg350-4d3707d7956352acb69f05e45084ee1964a2577f.zip
WAGE: Plugged even more memory leaks
Diffstat (limited to 'engines')
-rw-r--r--engines/wage/design.cpp3
-rw-r--r--engines/wage/entities.cpp3
-rw-r--r--engines/wage/entities.h1
-rw-r--r--engines/wage/world.cpp3
4 files changed, 9 insertions, 1 deletions
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 95151373e7..5ce1ff376c 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -75,7 +75,8 @@ Design::Design(Common::SeekableReadStream *data) {
Design::~Design() {
free(_data);
- _surface->free();
+ if (_surface && _surface->getPixels())
+ _surface->free();
delete _surface;
}
diff --git a/engines/wage/entities.cpp b/engines/wage/entities.cpp
index 61f579e4d2..1a9e936a61 100644
--- a/engines/wage/entities.cpp
+++ b/engines/wage/entities.cpp
@@ -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--)
diff --git a/engines/wage/entities.h b/engines/wage/entities.h
index 7cfe35ff63..ba190860ad 100644
--- a/engines/wage/entities.h
+++ b/engines/wage/entities.h
@@ -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,
diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp
index 7a15b9314a..c525bd33cc 100644
--- a/engines/wage/world.cpp
+++ b/engines/wage/world.cpp
@@ -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;