Browse Source

* fixed bug in SysTinyGetMem that caused heap corruption if the free block that's being allocated is followed tightly by an already allocated block

git-svn-id: trunk@24520 -
nickysn 12 years ago
parent
commit
f0ada1ccc5
1 changed files with 2 additions and 1 deletions
  1. 2 1
      rtl/inc/tinyheap.inc

+ 2 - 1
rtl/inc/tinyheap.inc

@@ -71,7 +71,8 @@
 
 
             pptruint(p)^ := size;
             pptruint(p)^ := size;
 
 
-            InternalTinyFreeMem(pointer(ptruint(p)+AllocSize), RestSize);
+            if RestSize > 0 then
+              InternalTinyFreeMem(pointer(ptruint(p)+AllocSize), RestSize);
           end
           end
         else
         else
           Result := nil;
           Result := nil;