* rtl/heap: fix SysReallocMem corruption in multi-thread use (thanks to Burkhard Carstens, #15323)

git-svn-id: trunk@14419 -
This commit is contained in:
micha 2009-12-12 09:28:41 +00:00
parent f660e7cc6c
commit a6e6e9d453

View File

@ -1255,6 +1255,7 @@ var
oldsize,
currsize : ptruint;
pcurr : pmemchunk_var;
loc_freelists : pfreelists;
begin
SysTryResizeMem := false;
@ -1301,7 +1302,10 @@ begin
end;
{ get pointer to block }
loc_freelists := @freelists;
pcurr := pmemchunk_var(pointer(p)-sizeof(tmemchunk_var_hdr));
if pcurr^.freelists <> loc_freelists then
exit;
oldsize := currsize;
{ do we need to allocate more memory ? }
@ -1319,7 +1323,7 @@ begin
if currsize>size then
currsize := split_block(pcurr, size);
with pcurr^.freelists^.internal_status do
with loc_freelists^.internal_status do
begin
inc(currheapused, currsize-oldsize);
if currheapused > maxheapused then