mirror of
https://github.com/QB64Official/qb64.git
synced 2024-07-04 23:30:24 +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 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
|
||||
|
|
Loading…
Reference in a new issue