Browse Source

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

marcoonthegit 2 years ago
parent
commit
8c888d9744
1 changed files with 2 additions and 0 deletions
  1. 2 0
      packages/fcl-xml/src/xmlconf.pp

+ 2 - 0
packages/fcl-xml/src/xmlconf.pp

@@ -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