mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-06-05 03:19:04 +02:00
* fixed getmem call with wrong size from reallocmem
This commit is contained in:
parent
57b5128e32
commit
a3749c8bf3
@ -536,6 +536,7 @@ end;
|
|||||||
|
|
||||||
function SysReAllocMem(var p:pointer;size : longint):pointer;
|
function SysReAllocMem(var p:pointer;size : longint):pointer;
|
||||||
var
|
var
|
||||||
|
orgsize,
|
||||||
currsize,
|
currsize,
|
||||||
foundsize,
|
foundsize,
|
||||||
sizeleft,
|
sizeleft,
|
||||||
@ -554,6 +555,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{ fix needed size }
|
{ fix needed size }
|
||||||
|
orgsize:=size;
|
||||||
size:=(size+sizeof(theaprecord)+(blocksize-1)) and (not (blocksize-1));
|
size:=(size+sizeof(theaprecord)+(blocksize-1)) and (not (blocksize-1));
|
||||||
{ fix p to point to the heaprecord }
|
{ fix p to point to the heaprecord }
|
||||||
pcurr:=pfreerecord(pointer(p)-sizeof(theaprecord));
|
pcurr:=pfreerecord(pointer(p)-sizeof(theaprecord));
|
||||||
@ -630,9 +632,9 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ we need to call getmem/move/freemem }
|
{ we need to call getmem/move/freemem }
|
||||||
p2:=MemoryManager.GetMem(size);
|
p2:=MemoryManager.GetMem(orgsize);
|
||||||
if p2<>nil then
|
if p2<>nil then
|
||||||
Move(p^,p2^,size);
|
Move(p^,p2^,orgsize);
|
||||||
MemoryManager.Freemem(p);
|
MemoryManager.Freemem(p);
|
||||||
p:=p2;
|
p:=p2;
|
||||||
SysReAllocMem:=p;
|
SysReAllocMem:=p;
|
||||||
@ -781,7 +783,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.25 1999-12-01 22:57:31 peter
|
Revision 1.26 1999-12-13 21:04:46 peter
|
||||||
|
* fixed getmem call with wrong size from reallocmem
|
||||||
|
|
||||||
|
Revision 1.25 1999/12/01 22:57:31 peter
|
||||||
* cmdline support
|
* cmdline support
|
||||||
|
|
||||||
Revision 1.24 1999/11/14 21:34:21 peter
|
Revision 1.24 1999/11/14 21:34:21 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user