🐛 Free the config document on validation failures

Invalid or outdated configuration leaked the parsed XML document
while aborting startup.
This commit is contained in:
2026-11-15 22:08:32 +01:00
parent 5910178309
commit 45386dcbaf
+4 -2
View File
@@ -203,6 +203,7 @@ begin
inherited Create;
FFilename := AFilename;
ReadXMLFile(xmlDoc, AFilename);
try
version := 0;
if not ((xmlDoc.DocumentElement.NodeName = 'CEDConfig') and
TryStrToInt(xmlDoc.DocumentElement.AttribStrings['Version'], version) and
@@ -236,9 +237,10 @@ begin
else
FMapStates := TMapStates.Create(Self);
xmlDoc.Free;
FChanged := False;
finally
xmlDoc.Free;
end;
end;
constructor TConfig.Init(AFilename: string);