summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-12-24 21:25:09 +0000
committersmatz <smatz@openttd.org>2008-12-24 21:25:09 +0000
commit921863da15b912dc07b838530fefaaa01a3599ae (patch)
tree60f715337d43520308a8a5088c9da8a6c7390cd6
parent4ec06cc478532e927ffa91a2298fc713608e8183 (diff)
downloadopenttd-921863da15b912dc07b838530fefaaa01a3599ae.tar.xz
(svn r14737) -Fix (r10211): memory leak in Action 0x0F (new town names)
-rw-r--r--src/newgrf.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index f44b993cd..e99915b57 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -4796,7 +4796,10 @@ static void FeatureTownName(byte *buf, size_t len)
if (!check_length(len, 1, "FeatureTownName: style name")) return;
const char *name = grf_load_string(&buf, len);
len -= strlen(name) + 1;
- grfmsg(6, "FeatureTownName: lang 0x%X -> '%s'", lang, TranslateTTDPatchCodes(grfid, name));
+
+ char *lang_name = TranslateTTDPatchCodes(grfid, name);
+ grfmsg(6, "FeatureTownName: lang 0x%X -> '%s'", lang, lang_name);
+ free(lang_name);
townname->name[nb_gen] = AddGRFString(grfid, id, lang, new_scheme, name, STR_UNDEFINED);