Avoid infinite loops with RTE 204 if heap is corrupted

git-svn-id: trunk@23845 -
This commit is contained in:
pierre 2013-03-15 15:40:23 +00:00
parent 18ece9cf75
commit 503b8c73c2
2 changed files with 9 additions and 2 deletions

View File

@ -1571,6 +1571,9 @@ var
i : longint;
{$endif}
begin
{ Do not try to do anything if the heap manager already reported an error }
if (errorcode=203) or (errorcode=204) then
exit;
loc_freelists := @freelists;
{$ifdef FPC_HAS_FEATURE_THREADING}
if heap_lock_use > 0 then

View File

@ -989,10 +989,14 @@ Begin
{$endif}
{$ifdef LINUX}
{sysfreemem already checks for nil}
sysfreemem(calculated_cmdline);
{ Do not try to do anything if the heap manager already reported an error }
if (errorcode<>203) and (errorcode<>204) then
sysfreemem(calculated_cmdline);
{$endif}
{$ifdef BSD}
sysfreemem(cmdline);
{ Do not try to do anything if the heap manager already reported an error }
if (errorcode<>203) and (errorcode<>204) then
sysfreemem(cmdline);
{$endif}
{$ifdef FPC_HAS_FEATURE_HEAP}