From dc320a2c0affe81fc54d13cc454b5987a62c7894 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sat, 27 Mar 2010 09:34:29 +0100 Subject: Properly handle failed stat Found when trying to get info of a non-existent file (badly constructed path). --- vfs/UVFSCore.pas | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'vfs/UVFSCore.pas') diff --git a/vfs/UVFSCore.pas b/vfs/UVFSCore.pas index 0ce7e1f..b39ad8e 100644 --- a/vfs/UVFSCore.pas +++ b/vfs/UVFSCore.pas @@ -523,12 +523,13 @@ begin end; try P := FSourcePlugin.FVFSFileInfo(FGlobs, PChar(APath), FollowSymlinks, AddFullPath, Error); - if P <> nil then + if P <> nil then begin Result := GetDataItemFromVFSItem(P); - if P^.FName <> nil then real_libc_free(P^.FName); - if P^.FDisplayName <> nil then real_libc_free(P^.FDisplayName); - if P^.sLinkTo <> nil then real_libc_free(P^.sLinkTo); - real_libc_free(P); + if P^.FName <> nil then real_libc_free(P^.FName); + if P^.FDisplayName <> nil then real_libc_free(P^.FDisplayName); + if P^.sLinkTo <> nil then real_libc_free(P^.sLinkTo); + real_libc_free(P); + end; except on E: Exception do begin DebugMsg(['^^VFS (EE): GetFileInfo: Exception: ', E.Message]); -- cgit v1.2.3