summaryrefslogtreecommitdiff
path: root/vfs/UVFSCore.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2010-03-27 09:34:29 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2010-03-27 09:34:29 +0100
commitdc320a2c0affe81fc54d13cc454b5987a62c7894 (patch)
tree0e4ba689e817141523d66fcaf60284186dd71b39 /vfs/UVFSCore.pas
parent112c3f0690d02c6a784fdfa9710c679487452fe9 (diff)
downloadtuxcmd-dc320a2c0affe81fc54d13cc454b5987a62c7894.tar.xz
Properly handle failed stat
Found when trying to get info of a non-existent file (badly constructed path).
Diffstat (limited to 'vfs/UVFSCore.pas')
-rw-r--r--vfs/UVFSCore.pas11
1 files changed, 6 insertions, 5 deletions
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]);