summaryrefslogtreecommitdiff
path: root/src/ai/ai_info.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ai/ai_info.cpp')
-rw-r--r--src/ai/ai_info.cpp3
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);
}