Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #147 - memory leak in CWOPS call history reader #148

Merged
merged 1 commit into from
Dec 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions CWOPS.pas
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function TCWOPS.LoadCallHistory(const AUserCallsign : string) : boolean;

slst:= TStringList.Create;
tl:= TStringList.Create;
CWO := nil;

try
CWOPSList.Clear;
Expand All @@ -64,7 +65,9 @@ function TCWOPS.LoadCallHistory(const AUserCallsign : string) : boolean;
for i:= 0 to slst.Count-1 do begin
self.Delimit(tl, slst.Strings[i]);
if (tl.Count = 4) then begin
CWO:= TCWOPSRec.Create;
if CWO = nil then
CWO:= TCWOPSRec.Create;

CWO.Call:= UpperCase(tl.Strings[0]);
CWO.Name:= UpperCase(tl.Strings[1]);
CWO.Number:= tl.Strings[2];
Expand All @@ -76,8 +79,7 @@ function TCWOPS.LoadCallHistory(const AUserCallsign : string) : boolean;
if length(CWO.Name) > 12 then continue;

CWOPSList.Add(CWO);


CWO := nil;
end;
end;

Expand All @@ -86,6 +88,7 @@ function TCWOPS.LoadCallHistory(const AUserCallsign : string) : boolean;
finally
slst.Free;
tl.Free;
if CWO <> nil then CWO.Free;
end;


Expand Down