소스 검색

human68k: handle the OS malloc returning errors properly

Karoly Balogh 1 년 전
부모
커밋
d85d6b4bac
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      rtl/human68k/sysheap.inc

+ 4 - 0
rtl/human68k/sysheap.inc

@@ -21,6 +21,10 @@
 function SysOSAlloc(size: ptruint): pointer;
 begin
   SysOSAlloc:=h68kdos_malloc(size);
+
+  { uppermost bit set means, the allocation has failed, so return nil }
+  if (PtrUInt(SysOSAlloc) and $80000000) > 0 then
+    SysOSAlloc:=nil;
 end;
 
 {$define HAS_SYSOSFREE}