mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-02-19 19:36:26 +01:00
compiler: set to nil after free
This commit is contained in:
parent
a618b486d3
commit
d53e4030af
@ -665,6 +665,7 @@ implementation
|
||||
destructor tai_simpletypedconst.destroy;
|
||||
begin
|
||||
fval.free;
|
||||
fval := nil;
|
||||
inherited destroy;
|
||||
end;
|
||||
|
||||
@ -719,7 +720,7 @@ implementation
|
||||
if ai.adetyp<>tck_simple then
|
||||
internalerror(2014070103);
|
||||
add_to_string(newstr,tai_simpletypedconst(ai).val);
|
||||
ai.free;
|
||||
ai.free; // no nil needed
|
||||
end;
|
||||
fvalues.count:=0;
|
||||
{ the "nil" def will be replaced with an array def of the appropriate
|
||||
@ -787,7 +788,8 @@ implementation
|
||||
1:
|
||||
begin
|
||||
add_to_string(tai_string(tai_simpletypedconst(fvalues[0]).val),tai_simpletypedconst(val).val);
|
||||
val.free
|
||||
val.free;
|
||||
val := nil;
|
||||
end
|
||||
else
|
||||
internalerror(2014070104);
|
||||
@ -849,6 +851,7 @@ implementation
|
||||
destructor tai_aggregatetypedconst.destroy;
|
||||
begin
|
||||
fvalues.free;
|
||||
fvalues := nil;
|
||||
inherited destroy;
|
||||
end;
|
||||
|
||||
@ -1044,6 +1047,7 @@ implementation
|
||||
fasmlist.concat(tai_symbol_end.Createname(asmsym.name));
|
||||
{ free the temporary list }
|
||||
prelist.free;
|
||||
prelist := nil;
|
||||
end;
|
||||
|
||||
|
||||
@ -1077,6 +1081,7 @@ implementation
|
||||
symind.increfs;
|
||||
|
||||
indtcb.free;
|
||||
indtcb := nil;
|
||||
if not (target_info.system in systems_indirect_var_imports) then
|
||||
current_module.add_public_asmsym(symind.name,AB_INDIRECT,AT_DATA);
|
||||
end;
|
||||
@ -1274,7 +1279,9 @@ implementation
|
||||
(ErrorCount=0) then
|
||||
internalerror(2014062901);
|
||||
faggregateinformation.free;
|
||||
faggregateinformation := nil;
|
||||
fasmlist.free;
|
||||
fasmlist := nil;
|
||||
inherited destroy;
|
||||
end;
|
||||
|
||||
@ -1559,6 +1566,7 @@ implementation
|
||||
info:=curagginfo;
|
||||
faggregateinformation.count:=faggregateinformation.count-1;
|
||||
info.free;
|
||||
info := nil;
|
||||
end;
|
||||
|
||||
|
||||
@ -1826,6 +1834,7 @@ implementation
|
||||
{ we emit the high value, not the count }
|
||||
arrlengthloc.replace(tai_const.Create_sizeint(arrlength-1),sizesinttype);
|
||||
arrlengthloc.free;
|
||||
arrlengthloc := nil;
|
||||
if get_dynarray_symofs=0 then
|
||||
emit_tai(tai_symbol_end.create(llofs.lab),arrdef);
|
||||
result:=end_anonymous_record;
|
||||
@ -1940,6 +1949,7 @@ implementation
|
||||
strtcb.get_final_asmlist(strlab,datadef,sec_rodata_norel,strlab.name,const_align(sizeof(pint)))
|
||||
);
|
||||
strtcb.free;
|
||||
strtcb := nil;
|
||||
|
||||
entry^.Data:=strlab;
|
||||
{ Make sure strlab has a reference }
|
||||
@ -2158,7 +2168,9 @@ implementation
|
||||
for i:=high(fields) downto low(fields) do
|
||||
queue_subscriptn(tabstractrecorddef(parentdefs[i]),tfieldvarsym(syms[i]));
|
||||
syms.free;
|
||||
syms := nil;
|
||||
parentdefs.free;
|
||||
parentdefs := nil;
|
||||
end;
|
||||
|
||||
|
||||
@ -2266,6 +2278,7 @@ implementation
|
||||
list.insertafter(ai,insertpos);
|
||||
list.remove(insertpos);
|
||||
insertpos.free;
|
||||
insertpos := nil;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ unit aasmdata;
|
||||
interface
|
||||
|
||||
uses
|
||||
cutils,cclasses,
|
||||
sysutils,cutils,cclasses,
|
||||
globtype,systems,
|
||||
cgbase,
|
||||
symtype,
|
||||
@ -556,7 +556,9 @@ implementation
|
||||
memasmsymbols.start;
|
||||
{$endif}
|
||||
FAltSymbolList.free;
|
||||
FAltSymbolList := nil;
|
||||
FAsmSymbolDict.free;
|
||||
FAsmSymbolDict := nil;
|
||||
{$ifdef MEMDEBUG}
|
||||
memasmsymbols.stop;
|
||||
{$endif}
|
||||
@ -565,6 +567,7 @@ implementation
|
||||
memasmcfi.start;
|
||||
{$endif}
|
||||
FAsmCFI.free;
|
||||
FAsmCFI := nil;
|
||||
{$ifdef MEMDEBUG}
|
||||
memasmcfi.stop;
|
||||
{$endif}
|
||||
@ -573,15 +576,18 @@ implementation
|
||||
memasmlists.start;
|
||||
{$endif}
|
||||
ResStrInits.free;
|
||||
ResStrInits := nil;
|
||||
WideInits.free;
|
||||
WideInits := nil;
|
||||
for hal:=low(TAsmListType) to high(TAsmListType) do
|
||||
AsmLists[hal].free;
|
||||
FreeAndNil(AsmLists[hal]);
|
||||
CurrAsmList.free;
|
||||
CurrAsmList := nil;
|
||||
{$ifdef MEMDEBUG}
|
||||
memasmlists.stop;
|
||||
{$endif}
|
||||
for hp := low(TConstPoolType) to high(TConstPoolType) do
|
||||
FConstPools[hp].Free;
|
||||
FreeAndNil(FConstPools[hp]);
|
||||
end;
|
||||
|
||||
function TAsmData.DefineAsmSymbolByClass(symclass: TAsmSymbolClass; const s: TSymStr; _bind: TAsmSymBind; _typ: Tasmsymtype; def: tdef): TAsmSymbol;
|
||||
@ -763,8 +769,11 @@ initialization
|
||||
finalization
|
||||
{$ifdef MEMDEBUG}
|
||||
memasmsymbols.free;
|
||||
memasmsymbols := nil;
|
||||
memasmcfi.free;
|
||||
memasmcfi := nil;
|
||||
memasmlists.free;
|
||||
memasmlists := nil;
|
||||
{$endif MEMDEBUG}
|
||||
|
||||
end.
|
||||
|
||||
@ -75,6 +75,7 @@ function TAsmDataDef.DefineAsmSymbolByClass(symclass: TAsmSymbolClass; const s:
|
||||
lower(symind.name),
|
||||
ptrdef.alignment));
|
||||
tcb.free;
|
||||
tcb := nil;
|
||||
if (_typ=AT_DATA_FORCEINDIRECT) and not (target_info.system in systems_indirect_var_imports) then
|
||||
current_module.add_public_asmsym(symind.name,AB_INDIRECT,AT_DATA);
|
||||
end;
|
||||
|
||||
@ -177,6 +177,7 @@ implementation
|
||||
destructor TGNUAssembler.Destroy;
|
||||
begin
|
||||
InstrWriter.free;
|
||||
InstrWriter := nil;
|
||||
inherited destroy;
|
||||
end;
|
||||
|
||||
|
||||
@ -379,6 +379,7 @@ Unit aopt;
|
||||
p.Debug_InsertInstrRegisterDependencyInfo;
|
||||
{$endif DEBUG_INSTRUCTIONREGISTERDEPENDENCIES}
|
||||
p.free;
|
||||
p := nil;
|
||||
StopTimer;
|
||||
end;
|
||||
|
||||
@ -389,7 +390,8 @@ Unit aopt;
|
||||
begin
|
||||
p:=cpreregallocscheduler.Create(AsmL);
|
||||
p.Optimize;
|
||||
p.free
|
||||
p.free;
|
||||
p := nil;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ Unit AoptObj;
|
||||
Interface
|
||||
|
||||
uses
|
||||
globtype,
|
||||
sysutils,globtype,
|
||||
aasmbase,aasmcpu,aasmtai,aasmdata,
|
||||
cclasses,
|
||||
cgbase,cgutils,
|
||||
@ -1227,7 +1227,7 @@ Unit AoptObj;
|
||||
i : TRegisterType;
|
||||
begin
|
||||
for i:=low(TRegisterType) to high(TRegisterType) do
|
||||
regs[i].Free;
|
||||
regs[i].free; // no nil needed
|
||||
end;
|
||||
|
||||
|
||||
@ -1671,7 +1671,7 @@ Unit AoptObj;
|
||||
procedure TAOptObj.RemoveInstruction(const hp: tai); inline;
|
||||
begin
|
||||
AsmL.Remove(hp);
|
||||
hp.Free;
|
||||
hp.Free; // no nil needed
|
||||
end;
|
||||
|
||||
|
||||
@ -1761,6 +1761,7 @@ Unit AoptObj;
|
||||
begin
|
||||
asml.remove(hp2);
|
||||
hp2.free;
|
||||
hp2 := nil;
|
||||
end;
|
||||
{ Anything except A_NOP must be left in place: these instructions
|
||||
execute before branch, so code stays correct if branch is removed. }
|
||||
@ -1871,6 +1872,7 @@ Unit AoptObj;
|
||||
end;
|
||||
asml.remove(hp1);
|
||||
hp1.free;
|
||||
hp1 := nil;
|
||||
end
|
||||
else
|
||||
p:=hp1;
|
||||
@ -2090,6 +2092,7 @@ Unit AoptObj;
|
||||
{$endif EXTDEBUG}
|
||||
asml.Remove(hp);
|
||||
hp.Free;
|
||||
hp := nil;
|
||||
Exit;
|
||||
end;
|
||||
else
|
||||
|
||||
@ -1403,7 +1403,7 @@ Implementation
|
||||
destructor TExternalAssembler.Destroy;
|
||||
begin
|
||||
if ffreewriter then
|
||||
writer.Free;
|
||||
writer.Free; // no nil needed
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@ -1428,8 +1428,10 @@ Implementation
|
||||
begin
|
||||
if assigned(ObjData) then
|
||||
ObjData.free;
|
||||
ObjData := nil;
|
||||
if assigned(ObjOutput) then
|
||||
ObjOutput.free;
|
||||
ObjOutput := nil;
|
||||
end;
|
||||
|
||||
|
||||
@ -2766,6 +2768,7 @@ Implementation
|
||||
ObjData.free;
|
||||
ObjData:=nil;
|
||||
ObjWriter.free;
|
||||
ObjWriter := nil;
|
||||
end;
|
||||
|
||||
|
||||
@ -2881,6 +2884,7 @@ Implementation
|
||||
ObjData.free;
|
||||
ObjData:=nil;
|
||||
ObjWriter.free;
|
||||
ObjWriter := nil;
|
||||
end;
|
||||
|
||||
|
||||
@ -2926,6 +2930,7 @@ Implementation
|
||||
a:=CAssembler[target_asm.id].Create(@target_asm,smart);
|
||||
a.MakeObject;
|
||||
a.Free;
|
||||
a := nil;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@ -1585,7 +1585,7 @@ implementation
|
||||
Note: this might happen legitimately when parsing a generic that
|
||||
passes an undefined type to Write/Read }
|
||||
if assigned(filetemp) then
|
||||
ctempdeletenode.create(filetemp).free;
|
||||
ctempdeletenode.create(filetemp).free; // no nil needed
|
||||
newblock.free;
|
||||
newblock := nil;
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user