Found using the Clang Static Analyzer.
* ftpfs/dir.c (refresh_dir): Fix error handling.
---
ftpfs/dir.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/ftpfs/dir.c b/ftpfs/dir.c
index da5ddbe..61c337b 100644
--- a/ftpfs/dir.c
+++ b/ftpfs/dir.c
@@ -381,8 +381,12 @@ refresh_dir (struct ftpfs_dir *dir, int update_stats,
time_t timestamp,
/* Make sure `.' and `..' are always included (if the actual list also
includes `.' and `..', the ordered may be rearranged). */
err = update_ordered_name (".", &dfs);
- if (! err)
- err = update_ordered_name ("..", &dfs);
+ if (err)
+ goto out;
+
+ err = update_ordered_name ("..", &dfs);
+ if (err)
+ goto out;
/* Refetch the directory from the server. */
if (update_stats)
@@ -407,6 +411,7 @@ refresh_dir (struct ftpfs_dir *dir, int update_stats,
time_t timestamp,
sweep (dir);
}
+ out:
ftpfs_release_ftp_conn (dir->fs, conn);
return err;
--
1.7.10.4