From e05a618483e8111d531a8f8dbe71988754c5d143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Van=20Canneyt?= Date: Tue, 18 Mar 2025 15:54:32 +0100 Subject: [PATCH] * Dyn ansichar array for fcoffstrs --- compiler/ogcoff.pas | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/compiler/ogcoff.pas b/compiler/ogcoff.pas index b21fb48b88..2ae46f93b3 100644 --- a/compiler/ogcoff.pas +++ b/compiler/ogcoff.pas @@ -175,7 +175,7 @@ interface TCoffObjInput = class(tObjInput) private FCoffsyms : tdynamicarray; - FCoffStrs : PChar; + FCoffStrs : TAnsiCharDynArray; FCoffStrSize: longword; { Convert symidx -> TObjSymbol } FSymTbl : ^TObjSymbolArray; @@ -2270,8 +2270,7 @@ const pemagic : array[0..3] of byte = ( destructor TCoffObjInput.destroy; begin FCoffSyms.free; - if assigned(FCoffStrs) then - freemem(FCoffStrs); + FCoffStrs:=nil; if assigned(FSymTbl) then freemem(FSymTbl); if assigned(FSecTbl) then @@ -2771,7 +2770,7 @@ const pemagic : array[0..3] of byte = ( if (FCoffStrSize>4) then begin { allocate an extra byte and null-terminate } - GetMem(FCoffStrs,FCoffStrSize+1); + SetLength(FCoffStrs,FCoffStrSize+1); FCoffStrs[FCoffStrSize]:=#0; for i:=0 to 3 do FCoffStrs[i]:=#0; @@ -2871,8 +2870,6 @@ const pemagic : array[0..3] of byte = ( { Relocs } ObjSectionList.ForEachCall(@objsections_read_relocs,nil); end; - if assigned(FCoffStrs) then - freemem(FCoffStrs); FCoffStrs:=nil; FCoffSyms.Free; FCoffSyms:=nil;