mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-11 02:00:51 +00:00
[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:
parent
fb92ee12d6
commit
6c56e93fc8
1 changed files with 3 additions and 1 deletions
|
@ -142,7 +142,9 @@ PR_PopFrame (progs_t *pr)
|
||||||
// when calling a function and the callee was another builtin that
|
// when calling a function and the callee was another builtin that
|
||||||
// did not call a progs function, then the push strings will still be
|
// did not call a progs function, then the push strings will still be
|
||||||
// valid because PR_EnterFunction was never called
|
// 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_xtstr = pr->pr_pushtstr;
|
||||||
pr->pr_pushtstr = 0;
|
pr->pr_pushtstr = 0;
|
||||||
PR_FreeTempStrings (pr);
|
PR_FreeTempStrings (pr);
|
||||||
|
|
Loading…
Reference in a new issue