mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 15:29:25 +02:00
* fixed memory corruption in trgobj.add_to_movelist on 64 bit platforms
git-svn-id: trunk@9523 -
This commit is contained in:
parent
58600c71b9
commit
8d9bfcaa7d
@ -661,7 +661,8 @@ unit rgobj;
|
||||
begin
|
||||
if movelist=nil then
|
||||
begin
|
||||
getmem(movelist,sizeof(tmovelistheader)+60*sizeof(pointer));
|
||||
{ don't use sizeof(tmovelistheader), because that ignores alignment }
|
||||
getmem(movelist,ptrint(@movelist^.data)-ptrint(movelist)+60*sizeof(pointer));
|
||||
movelist^.header.maxcount:=60;
|
||||
movelist^.header.count:=0;
|
||||
movelist^.header.sorted_until:=0;
|
||||
@ -671,7 +672,8 @@ unit rgobj;
|
||||
if movelist^.header.count>=movelist^.header.maxcount then
|
||||
begin
|
||||
movelist^.header.maxcount:=movelist^.header.maxcount*2;
|
||||
reallocmem(movelist,sizeof(tmovelistheader)+movelist^.header.maxcount*sizeof(pointer));
|
||||
{ don't use sizeof(tmovelistheader), because that ignores alignment }
|
||||
reallocmem(movelist,ptrint(@movelist^.data)-ptrint(movelist)+movelist^.header.maxcount*sizeof(pointer));
|
||||
end;
|
||||
end;
|
||||
movelist^.data[movelist^.header.count]:=data;
|
||||
|
Loading…
Reference in New Issue
Block a user