浏览代码

* Fixed file handle leak when creating GUIDs

git-svn-id: trunk@11121 -
michael 17 年之前
父节点
当前提交
8b94b4b849
共有 1 个文件被更改,包括 5 次插入6 次删除
  1. 5 6
      rtl/linux/suuid.inc

+ 5 - 6
rtl/linux/suuid.inc

@@ -62,15 +62,14 @@ begin
   Result:=(Fd>=0);
   if Result then
     try
-    SetLength(S,UUIDLen);
-    SetLength(S,FileRead(fd,S[1],UUIDLen));
-    Result:=(Length(S)=UUIDLen);
-    If Result then
-      GUID:=StringToGUID('{'+S+'}');
+      SetLength(S,UUIDLen);
+      SetLength(S,FileRead(fd,S[1],UUIDLen));
+      Result:=(Length(S)=UUIDLen);
+      If Result then
+        GUID:=StringToGUID('{'+S+'}');
     finally
       FileClose(FD);  
     end;
-    end;
 end;
 
 Function SysCreateGUID(out GUID : TGUID) : Integer;