[gamecode] Be more careful with temp strings

If a temp string is found in the return slot, PR_FreeTempStrings won't
delete the string. However, PR_PopFrame was blindly stomping on the
possibly surviving temp string with the push strings, which would cause
a leak.
This commit is contained in:
Bill Currie 2020-03-10 03:24:31 +09:00
parent fb92ee12d6
commit 6c56e93fc8

View file

@ -142,7 +142,9 @@ PR_PopFrame (progs_t *pr)
// when calling a function and the callee was another builtin that
// did not call a progs function, then the push strings will still be
// valid because PR_EnterFunction was never called
if (pr->pr_pushtstr) {
// however, not if a temp string survived: better to hold on to the push
// strings a little longer than lose one erroneously
if (!pr->pr_xtstr && pr->pr_pushtstr) {
pr->pr_xtstr = pr->pr_pushtstr;
pr->pr_pushtstr = 0;
PR_FreeTempStrings (pr);