Преглед на файлове

* return nil in SysTinyReallocMem, when the size parameter is 0

git-svn-id: trunk@26892 -
nickysn преди 11 години
родител
ревизия
640f6ea300
променени са 1 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 4 1
      rtl/inc/tinyheap.inc

+ 4 - 1
rtl/inc/tinyheap.inc

@@ -216,7 +216,10 @@
 {$ifdef DEBUG_TINY_HEAP}
         Write('SysTinyReAllocMem(', ptruint(p), ',', size, ')=');
 {$endif DEBUG_TINY_HEAP}
-        result := AllocMem(size);
+        if size=0 then
+          result := nil
+        else
+          result := AllocMem(size);
         if result <> nil then
           begin
             if p <> nil then