mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 22:49:23 +02:00
* Clean up mswindows/os2 ARGV release in InternalExit to avoid crash if called twice
git-svn-id: trunk@17702 -
This commit is contained in:
parent
144d4c41f2
commit
0af77f8957
@ -896,10 +896,20 @@ Begin
|
|||||||
|
|
||||||
{$if defined(MSWINDOWS) or defined(OS2)}
|
{$if defined(MSWINDOWS) or defined(OS2)}
|
||||||
{ finally release the heap if possible, especially
|
{ finally release the heap if possible, especially
|
||||||
important for DLLs }
|
important for DLLs.
|
||||||
for i:=0 to argc do
|
Reset the array to nil, and finally also argv itself to
|
||||||
sysfreemem(argv[i]);
|
avoid double freeing problem in case this function gets called twice. }
|
||||||
sysfreemem(argv);
|
if assigned(argv) then
|
||||||
|
begin
|
||||||
|
for i:=0 to argc-1 do
|
||||||
|
if assigned(argv[i]) then
|
||||||
|
begin
|
||||||
|
sysfreemem(argv[i]);
|
||||||
|
argv[i]:=nil;
|
||||||
|
end;
|
||||||
|
sysfreemem(argv);
|
||||||
|
argv:=nil;
|
||||||
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
{$ifdef LINUX}
|
{$ifdef LINUX}
|
||||||
{sysfreemem already checks for nil}
|
{sysfreemem already checks for nil}
|
||||||
|
Loading…
Reference in New Issue
Block a user