From 163ee92ef582b1ce494e569ef66478192d4d6f57 Mon Sep 17 00:00:00 2001 From: nickysn Date: Fri, 1 Dec 2017 13:39:20 +0000 Subject: [PATCH] * handle gracefully freeing a subblock that is located at the end of its block (with no free space after it) in the win16 global heap manager git-svn-id: trunk@37636 - --- rtl/win16/glbheap.inc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/rtl/win16/glbheap.inc b/rtl/win16/glbheap.inc index 3b85180861..29dddcc9af 100644 --- a/rtl/win16/glbheap.inc +++ b/rtl/win16/glbheap.inc @@ -215,20 +215,19 @@ circular linked list. begin PrevSubBlock:=nil; CurSubBlock:=Ptr(CurBlock,CurBlockP^.FirstFreeOfs); - while Ofs(CurSubBlock^)0) and (Ofs(CurSubBlock^)0) and ((Ofs(PrevSubBlock^)+PrevSubBlock^.Size)=Ofs(CurSubBlock^)) then begin Inc(PrevSubBlock^.Size,CurSubBlock^.Size); PrevSubBlock^.Next:=CurSubBlock^.Next; @@ -237,7 +236,7 @@ circular linked list. else begin PrevSubBlock^.Next:=Ofs(Addr^); - if (Ofs(Addr^)+ASize)=Ofs(CurSubBlock^) then + if (Ofs(CurSubBlock^)<>0) and ((Ofs(Addr^)+ASize)=Ofs(CurSubBlock^)) then with PFreeSubBlock(Addr)^ do begin Next:=CurSubBlock^.Next;