Sfoglia il codice sorgente

human68k: handle the OS malloc returning errors properly

Karoly Balogh 1 anno fa
parent
commit
d85d6b4bac
1 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  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}