Ver código fonte

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

marcoonthegit 2 anos atrás
pai
commit
8c888d9744
1 arquivos alterados com 2 adições e 0 exclusões
  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