* free doc before calling a readxmlfile procedure routine with OUT parameter. Fixes #40126

(cherry picked from commit 8c888d9744)
This commit is contained in:
marcoonthegit 2023-01-23 18:48:08 +01:00
parent 66bfb69e96
commit 3aa9e1dc62

View File

@ -167,6 +167,7 @@ begin
F:=TFileStream.Create(AFileName,fmOpenread or fmShareDenyWrite);
try
FFileName := '';
Doc.Free;
ReadXMLFile(Doc, AFilename);
FFileName:=AFileName;
finally
@ -176,6 +177,7 @@ end;
procedure TXMLConfig.LoadFromStream(S: TStream);
begin
Doc.Free;
ReadXMLFile(Doc,S);
FModified := False;
if (Doc.DocumentElement.NodeName<>FRootName) then