1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-30 05:10:37 +00:00

Fix memory leak with PRINT USING

When USING follows another print in the same statement (such as PRINT
"123"; USING "###"; 456), it created a memory leak due to the temp
variable being created twice and only freed once.  This patch corrects
that issue.
This commit is contained in:
SteveMcNeill 2018-10-22 01:02:48 -04:00
parent 4787076573
commit 67af468b7d

View file

@ -22335,7 +22335,7 @@ SUB xprint (a$, ca$, n)
IF puformat$ = "" THEN Give_Error "Expected PRINT USING formatstring ; ...": EXIT SUB
IF i = n THEN Give_Error "Expected PRINT USING formatstring ; ...": EXIT SUB
'create build string
PRINT #12, "tqbs=qbs_new(0,0);"
IF TQBSset = 0 THEN PRINT #12, "tqbs=qbs_new(0,0);"
'set format start/index variable
PRINT #12, "tmp_long=0;" 'scan format from beginning
@ -22439,6 +22439,7 @@ SUB xprint (a$, ca$, n)
e$ = ""
last = 0
PRINT #12, "tqbs=qbs_new(0,0);" 'initialize the temp string
TQBSset = -1 'set the temporary flag so we don't create a temp string twice, in case USING comes after something
FOR i = 2 TO n
a2$ = getelement(ca$, i)
IF a2$ = "(" THEN b = b + 1