mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 13:09:16 +02:00
* Fixed file handle leak when creating GUIDs
git-svn-id: trunk@11121 -
This commit is contained in:
parent
48bf280781
commit
8b94b4b849
@ -62,15 +62,14 @@ begin
|
|||||||
Result:=(Fd>=0);
|
Result:=(Fd>=0);
|
||||||
if Result then
|
if Result then
|
||||||
try
|
try
|
||||||
SetLength(S,UUIDLen);
|
SetLength(S,UUIDLen);
|
||||||
SetLength(S,FileRead(fd,S[1],UUIDLen));
|
SetLength(S,FileRead(fd,S[1],UUIDLen));
|
||||||
Result:=(Length(S)=UUIDLen);
|
Result:=(Length(S)=UUIDLen);
|
||||||
If Result then
|
If Result then
|
||||||
GUID:=StringToGUID('{'+S+'}');
|
GUID:=StringToGUID('{'+S+'}');
|
||||||
finally
|
finally
|
||||||
FileClose(FD);
|
FileClose(FD);
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function SysCreateGUID(out GUID : TGUID) : Integer;
|
Function SysCreateGUID(out GUID : TGUID) : Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user