mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 14:49:47 +02:00
* rtl/heap: fix SysReallocMem corruption in multi-thread use (thanks to Burkhard Carstens, #15323)
git-svn-id: trunk@14419 -
This commit is contained in:
parent
f660e7cc6c
commit
a6e6e9d453
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user