mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-31 16:50:47 +02:00
* Fix handle leak in case findfirst returns not 0. (bug ID 32012)
git-svn-id: trunk@36510 -
This commit is contained in:
parent
f2c23a8407
commit
743a000675
@ -444,6 +444,14 @@ begin
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
Procedure InternalFindClose (var Handle: THandle; var FindData: TFindData);
|
||||
begin
|
||||
if Handle <> INVALID_HANDLE_VALUE then
|
||||
begin
|
||||
Windows.FindClose(Handle);
|
||||
Handle:=INVALID_HANDLE_VALUE;
|
||||
end;
|
||||
end;
|
||||
|
||||
Function InternalFindFirst (Const Path : UnicodeString; Attr : Longint; out Rslt : TAbstractSearchRec; var Name : UnicodeString) : Longint;
|
||||
begin
|
||||
@ -460,6 +468,8 @@ begin
|
||||
end;
|
||||
{ Find file with correct attribute }
|
||||
Result:=FindMatch(Rslt,Name);
|
||||
if (Result<>0) then
|
||||
InternalFindClose(Rslt.FindHandle,Rslt.FindData);
|
||||
end;
|
||||
|
||||
Function InternalFindNext (Var Rslt : TAbstractSearchRec; var Name: UnicodeString) : Longint;
|
||||
@ -471,11 +481,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
Procedure InternalFindClose (var Handle: THandle; var FindData: TFindData);
|
||||
begin
|
||||
if Handle <> INVALID_HANDLE_VALUE then
|
||||
Windows.FindClose(Handle);
|
||||
end;
|
||||
|
||||
|
||||
Function FileGetDate (Handle : THandle) : Longint;
|
||||
|
Loading…
Reference in New Issue
Block a user