summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2009-01-17 15:07:35 +0000
committertruebrain <truebrain@openttd.org>2009-01-17 15:07:35 +0000
commit27717e1b6d7e6bde1607cf22730a983d81e866fa (patch)
tree6879790d92281a85eb9795b8f23487f761c74011
parentfe900776814d098dbb5799bf4ab387ea072277b6 (diff)
downloadopenttd-27717e1b6d7e6bde1607cf22730a983d81e866fa.tar.xz
(svn r15121) -Fix: more mem-leak fixes (this should make SmatZ so happy ;) :p)
-rw-r--r--src/ai/ai_config.cpp6
-rw-r--r--src/ai/ai_scanner.cpp3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/ai/ai_config.cpp b/src/ai/ai_config.cpp
index d09fc39c0..cd0cc8f30 100644
--- a/src/ai/ai_config.cpp
+++ b/src/ai/ai_config.cpp
@@ -55,7 +55,11 @@ AIConfig::AIConfig(const AIConfig *config)
AIConfig::~AIConfig()
{
- this->ChangeAI(NULL);
+ free((void *)this->name);
+ for (SettingValueList::iterator it = this->settings.begin(); it != this->settings.end(); it++) {
+ free((void*)(*it).first);
+ }
+ this->settings.clear();
}
AIInfo *AIConfig::GetInfo()
diff --git a/src/ai/ai_scanner.cpp b/src/ai/ai_scanner.cpp
index d7fc258c7..11f4cdafd 100644
--- a/src/ai/ai_scanner.cpp
+++ b/src/ai/ai_scanner.cpp
@@ -179,6 +179,7 @@ AIScanner::~AIScanner()
delete (*lit).second;
}
+ delete this->info_dummy;
delete this->engine;
}
@@ -331,7 +332,7 @@ void AIScanner::RegisterAI(AIInfo *info)
strtolower(ai_name);
if (this->info_single_list.find(ai_name) == this->info_single_list.end()) {
this->info_single_list[strdup(ai_name)] = info;
- } else if (this->info_single_list[strdup(ai_name)]->GetVersion() < info->GetVersion()) {
+ } else if (this->info_single_list[ai_name]->GetVersion() < info->GetVersion()) {
this->info_single_list[ai_name] = info;
}
}