mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
FIX: Possible memory leak.
This commit is contained in:
parent
6f4f382faa
commit
3dca60a3ab
1 changed files with 13 additions and 9 deletions
|
|
@ -184,18 +184,22 @@ end;
|
|||
constructor TFileSystemFile.Create(FilePath: String);
|
||||
var
|
||||
SearchRecord: TSearchRec;
|
||||
FindResult: Longint;
|
||||
begin
|
||||
if FindFirstEx(FilePath, faAnyFile, SearchRecord) <> 0 then
|
||||
begin
|
||||
FindResult := FindFirstEx(FilePath, faAnyFile, SearchRecord);
|
||||
try
|
||||
if FindResult <> 0 then
|
||||
begin
|
||||
raise EFileSystemFileNotExists.Create('File ' + FilePath + ' does not exist.');
|
||||
end
|
||||
else
|
||||
Create(SearchRecord);
|
||||
|
||||
Path := ExtractFilePath(FilePath);
|
||||
|
||||
finally
|
||||
FindCloseEx(SearchRecord);
|
||||
raise EFileSystemFileNotExists.Create('File ' + FilePath + ' does not exist.');
|
||||
end
|
||||
else
|
||||
Create(SearchRecord);
|
||||
|
||||
Path := ExtractFilePath(FilePath);
|
||||
|
||||
FindCloseEx(SearchRecord);
|
||||
end;
|
||||
end;
|
||||
|
||||
destructor TFileSystemFile.Destroy;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue