Mercurial > hg > openttd
changeset 20047:c7ea604e5c19 draft
(svn r24980) -Fix: memory leak in corner case of handling encoded strings
author | rubidium <rubidium@openttd.org> |
---|---|
date | Fri, 08 Feb 2013 20:31:51 +0000 |
parents | 758b2cd8acc6 |
children | 7b49d51c1dd2 |
files | src/strings.cpp |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/strings.cpp +++ b/src/strings.cpp @@ -889,11 +889,11 @@ sub_args.SetParam(i++, (uint64)(size_t)g); } } - /* We error'd out in the while, to error out in themain too */ - if (*str == '\0') break; - - str = p; - buff = GetStringWithArgs(buff, (GAME_TEXT_TAB << TAB_COUNT_OFFSET) + stringid, &sub_args, last, true); + /* If we didn't error out, we can actually print the string. */ + if (*str != '\0') { + str = p; + buff = GetStringWithArgs(buff, (GAME_TEXT_TAB << TAB_COUNT_OFFSET) + stringid, &sub_args, last, true); + } for (int i = 0; i < 20; i++) { if (sub_args_need_free[i]) free((void *)sub_args.GetParam(i));