* ensure that the file parameter for the Read/Write family of intrinsics is (and can be) freed in tinlinenode.handle_read_write()

git-svn-id: trunk@39565 -
This commit is contained in:
svenbarth 2018-08-04 08:37:01 +00:00
parent 71bbab3512
commit 781303c0d8

View File

@ -1095,7 +1095,7 @@ implementation
in_writeln_x:
name:='fpc_writeln_end';
end;
addstatement(Tstatementnode(newstatement),ccallnode.createintern(name,filepara));
addstatement(Tstatementnode(newstatement),ccallnode.createintern(name,filepara.getcopy));
end;
handle_text_read_write:=found_error;
end;
@ -1206,8 +1206,6 @@ implementation
para := nextpara;
end;
{ free the file parameter }
filepara.free;
handle_typed_read_write:=found_error;
end;
@ -1423,6 +1421,9 @@ implementation
else
found_error:=handle_text_read_write(filepara,Ttertiarynode(params),tnode(newstatement));
{ free the file parameter (it's copied inside the handle_*_read_write methods) }
filepara.free;
{ if we found an error, simply delete the generated blocknode }
if found_error then
newblock.free