Browse Source

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

git-svn-id: trunk@26892 -
nickysn 11 years ago
parent
commit
640f6ea300
1 changed files with 4 additions and 1 deletions
  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