Browse Source

human68k: handle the OS malloc returning errors properly

Karoly Balogh 1 year ago
parent
commit
d85d6b4bac
1 changed files with 4 additions and 0 deletions
  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}