diff --git a/rtl/inc/heap.inc b/rtl/inc/heap.inc index 4dae1fb475..dfb05cd75e 100644 --- a/rtl/inc/heap.inc +++ b/rtl/inc/heap.inc @@ -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 diff --git a/tests/tbs/tb0710.pp b/tests/tbs/tb0710.pp new file mode 100644 index 0000000000..cac2e57024 --- /dev/null +++ b/tests/tbs/tb0710.pp @@ -0,0 +1,8 @@ +var + p : pointer; +begin + p:=getmem(0); + if not(assigned(p)) then + halt(1); + freemem(p); +end.