mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 10:40:13 +02:00
* patch by Rika + test: Don’t explicitly change GetMem(0) to GetMem(1), it works anyway, resolves #40456
This commit is contained in:
parent
6bdf9eb096
commit
4e1f854d49
@ -1075,11 +1075,7 @@ end;
|
||||
|
||||
function SysGetMem(size : ptruint):pointer;
|
||||
begin
|
||||
{ Something to allocate ? }
|
||||
if size=0 then
|
||||
{ we always need to allocate something, using heapend is not possible,
|
||||
because heappend can be changed by growheap (PFV) }
|
||||
size := 1;
|
||||
{ SysGetMem(0) is expected to return something freeable and non-nil. No need in explicit handling, presently. }
|
||||
{ calc to multiple of 16 after adding the needed bytes for memchunk header }
|
||||
if size <= (maxblocksize - sizeof(tmemchunk_fixed_hdr)) then
|
||||
begin
|
||||
|
8
tests/tbs/tb0710.pp
Normal file
8
tests/tbs/tb0710.pp
Normal file
@ -0,0 +1,8 @@
|
||||
var
|
||||
p : pointer;
|
||||
begin
|
||||
p:=getmem(0);
|
||||
if not(assigned(p)) then
|
||||
halt(1);
|
||||
freemem(p);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user