🐛 Free the config document on validation failures
Invalid or outdated configuration leaked the parsed XML document while aborting startup.
This commit is contained in:
+4
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user