summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2009-01-17 15:38:37 +0000
committertruebrain <truebrain@openttd.org>2009-01-17 15:38:37 +0000
commit4bc7afae41f347be2f74bdfc993827c5ada655bd (patch)
tree78feb67348d12d4c1d06f918f9310cd8ffa01e6f /src
parent3abb8abd07e56b4b051d57cd6e6f1c56ab8bdb64 (diff)
downloadopenttd-4bc7afae41f347be2f74bdfc993827c5ada655bd.tar.xz
(svn r15124) -Fix: last memory leak related to NoAI
Diffstat (limited to 'src')
-rw-r--r--src/ai/ai_instance.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp
index cc8893c9d..5f95b7d60 100644
--- a/src/ai/ai_instance.cpp
+++ b/src/ai/ai_instance.cpp
@@ -148,6 +148,7 @@ AIInstance::AIInstance(AIInfo *info) :
AIInstance::~AIInstance()
{
+ if (instance != NULL) this->engine->ReleaseObject(this->instance);
if (engine != NULL) delete this->engine;
delete this->storage;
delete this->controller;
@@ -246,7 +247,9 @@ void AIInstance::Died()
DEBUG(ai, 0, "The AI died unexpectedly.");
this->is_dead = true;
+ this->engine->ReleaseObject(this->instance);
delete this->engine;
+ this->instance = NULL;
this->engine = NULL;
}