Use TFPList.FreeAndNilDisposing in four more places.

This commit is contained in:
Rika Ichinose 2024-10-27 21:37:00 +03:00 committed by FPK
parent 183a10b292
commit bff561063f
2 changed files with 4 additions and 25 deletions

View File

@ -1103,14 +1103,10 @@ implementation
class procedure tnodeutils.release_init_final_list(list:tfplist); class procedure tnodeutils.release_init_final_list(list:tfplist);
var
i : longint;
begin begin
if not assigned(list) then if not assigned(list) then
internalerror(2017051901); internalerror(2017051901);
for i:=0 to list.count-1 do TFPList.FreeAndNilDisposing(list,typeinfo(tinitfinalentry));
dispose(pinitfinalentry(list[i]));
list.free;
end; end;

View File

@ -1974,12 +1974,8 @@ implementation
destructor tgenericconstraintdata.destroy; destructor tgenericconstraintdata.destroy;
var
i : longint;
begin begin
for i:=0 to interfacesderef.count-1 do TFPList.FreeAndNilDisposing(interfacesderef,typeinfo(tderef));
dispose(pderef(interfacesderef[i]));
interfacesderef.free;
interfaces.free; interfaces.free;
inherited destroy; inherited destroy;
end; end;
@ -2103,8 +2099,6 @@ implementation
destructor tstoreddef.destroy; destructor tstoreddef.destroy;
var
i : longint;
begin begin
{ Direct calls are not allowed, use symtable.deletedef() } { Direct calls are not allowed, use symtable.deletedef() }
if assigned(owner) then if assigned(owner) then
@ -2116,10 +2110,7 @@ implementation
end; end;
rtti_attribute_list.free; rtti_attribute_list.free;
genericparas.free; genericparas.free;
if assigned(genericparaderefs) then TFPList.FreeAndNilDisposing(genericparaderefs,typeinfo(tderef));
for i:=0 to genericparaderefs.count-1 do
dispose(pderef(genericparaderefs[i]));
genericparaderefs.free;
genconstraintdata.free; genconstraintdata.free;
{$ifndef symansistr} {$ifndef symansistr}
stringdispose(_fullownerhierarchyname); stringdispose(_fullownerhierarchyname);
@ -6797,19 +6788,11 @@ implementation
procedure tprocdef.freeimplprocdefinfo; procedure tprocdef.freeimplprocdefinfo;
var
i : longint;
begin begin
if assigned(implprocdefinfo) then if assigned(implprocdefinfo) then
begin begin
stringdispose(implprocdefinfo^.resultname); stringdispose(implprocdefinfo^.resultname);
if assigned(implprocdefinfo^.capturedsyms) then TFPList.FreeAndNilDisposing(implprocdefinfo^.capturedsyms,typeinfo(tcapturedsyminfo));
begin
for i:=0 to implprocdefinfo^.capturedsyms.count-1 do
dispose(pcapturedsyminfo(implprocdefinfo^.capturedsyms[i]));
end;
implprocdefinfo^.capturedsyms.free;
implprocdefinfo^.capturedsyms:=nil;
freemem(implprocdefinfo); freemem(implprocdefinfo);
implprocdefinfo:=nil; implprocdefinfo:=nil;
end; end;