From fac5cee3d3a0dd116f548c92a569c5cb58ed29ee Mon Sep 17 00:00:00 2001 From: truebrain Date: Sat, 17 Jan 2009 15:38:37 +0000 Subject: (svn r15124) -Fix: last memory leak related to NoAI --- src/ai/ai_instance.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ai') 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; } -- cgit v1.2.3-54-g00ecf