mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-02 05:00:38 +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:
parent
4787076573
commit
67af468b7d
|
@ -22335,7 +22335,7 @@ SUB xprint (a$, ca$, n)
|
||||||
IF puformat$ = "" THEN Give_Error "Expected PRINT USING formatstring ; ...": EXIT SUB
|
IF puformat$ = "" THEN Give_Error "Expected PRINT USING formatstring ; ...": EXIT SUB
|
||||||
IF i = n THEN Give_Error "Expected PRINT USING formatstring ; ...": EXIT SUB
|
IF i = n THEN Give_Error "Expected PRINT USING formatstring ; ...": EXIT SUB
|
||||||
'create build string
|
'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
|
'set format start/index variable
|
||||||
PRINT #12, "tmp_long=0;" 'scan format from beginning
|
PRINT #12, "tmp_long=0;" 'scan format from beginning
|
||||||
|
|
||||||
|
@ -22439,6 +22439,7 @@ SUB xprint (a$, ca$, n)
|
||||||
e$ = ""
|
e$ = ""
|
||||||
last = 0
|
last = 0
|
||||||
PRINT #12, "tqbs=qbs_new(0,0);" 'initialize the temp string
|
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
|
FOR i = 2 TO n
|
||||||
a2$ = getelement(ca$, i)
|
a2$ = getelement(ca$, i)
|
||||||
IF a2$ = "(" THEN b = b + 1
|
IF a2$ = "(" THEN b = b + 1
|
||||||
|
|
Loading…
Reference in a new issue