mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 03:19:29 +02:00
* Fixed file handle leak when creating GUIDs
git-svn-id: trunk@11120 -
This commit is contained in:
parent
971a28ece4
commit
48bf280781
@ -61,14 +61,14 @@ begin
|
|||||||
fd:=FileOpen(KernelUUID,fmOpenRead);
|
fd:=FileOpen(KernelUUID,fmOpenRead);
|
||||||
Result:=(Fd>=0);
|
Result:=(Fd>=0);
|
||||||
if Result then
|
if Result then
|
||||||
begin
|
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
|
||||||
begin
|
|
||||||
GUID:=StringToGUID('{'+S+'}');
|
GUID:=StringToGUID('{'+S+'}');
|
||||||
//Writeln('Kernel ID = ',GuidToString(GUID));
|
finally
|
||||||
|
FileClose(FD);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user