diff options
author | truebrain <truebrain@openttd.org> | 2009-01-17 14:54:24 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2009-01-17 14:54:24 +0000 |
commit | fe900776814d098dbb5799bf4ab387ea072277b6 (patch) | |
tree | d6b79724651cef87fc2edd5fc068f6100c053697 /src/ai/ai_scanner.cpp | |
parent | 2cc217cabf862e2133735c70c74e0d533197e739 (diff) | |
download | openttd-fe900776814d098dbb5799bf4ab387ea072277b6.tar.xz |
(svn r15120) -Fix: more mem-leak fixes
Diffstat (limited to 'src/ai/ai_scanner.cpp')
-rw-r--r-- | src/ai/ai_scanner.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ai/ai_scanner.cpp b/src/ai/ai_scanner.cpp index 3c74cdb92..d7fc258c7 100644 --- a/src/ai/ai_scanner.cpp +++ b/src/ai/ai_scanner.cpp @@ -277,7 +277,10 @@ void AIScanner::RegisterLibrary(AILibrary *library) if (this->library_list.find(library_name) != this->library_list.end()) { /* This AI was already registered */ - if (strcmp(this->library_list[library_name]->GetMainScript(), library->GetMainScript()) == 0) return; + if (strcmp(this->library_list[library_name]->GetMainScript(), library->GetMainScript()) == 0) { + delete library; + return; + } DEBUG(ai, 0, "Registering two libraries with the same name and version"); DEBUG(ai, 0, " 1: %s", this->library_list[library_name]->GetMainScript()); @@ -306,7 +309,10 @@ void AIScanner::RegisterAI(AIInfo *info) if (this->info_list.find(ai_name) != this->info_list.end()) { /* This AI was already registered */ - if (strcmp(this->info_list[ai_name]->GetMainScript(), info->GetMainScript()) == 0) return; + if (strcmp(this->info_list[ai_name]->GetMainScript(), info->GetMainScript()) == 0) { + delete info; + return; + } DEBUG(ai, 0, "Registering two AIs with the same name and version"); DEBUG(ai, 0, " 1: %s", this->info_list[ai_name]->GetMainScript()); |