diff options
author | frosch <frosch@openttd.org> | 2010-10-16 20:34:43 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-10-16 20:34:43 +0000 |
commit | 98250ad8da83fe6f842437bb614df28a1fe217c6 (patch) | |
tree | bfa52c0de54fa6c0a8c46d8b576555408ebcdc68 /src/ai/ai_info.cpp | |
parent | 82d4ffacff3398b44b2b16466f1305d607f0f57f (diff) | |
download | openttd-98250ad8da83fe6f842437bb614df28a1fe217c6.tar.xz |
(svn r20951) -Codechange: Add SmallMap::Contains() and use it.
Diffstat (limited to 'src/ai/ai_info.cpp')
-rw-r--r-- | src/ai/ai_info.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp index ff5dca946..54725cd48 100644 --- a/src/ai/ai_info.cpp +++ b/src/ai/ai_info.cpp @@ -307,7 +307,8 @@ SQInteger AIInfo::AddLabels(HSQUIRRELVM vm) int key = atoi(key_string + 1); const char *label = SQ2OTTD(sq_label); - if (config->labels->Find(key) == config->labels->End()) config->labels->Insert(key, strdup(label)); + /* !Contains() prevents strdup from leaking. */ + if (!config->labels->Contains(key)) config->labels->Insert(key, strdup(label)); sq_pop(vm, 2); } |