fix leak in an error path of get_file_status()
diff --git a/lib/worktree.c b/lib/worktree.c
index 626e3c5..2e614c8 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -1184,8 +1184,10 @@ get_file_status(unsigned char *status, struct stat *sb,
if (dirfd != -1) {
fd = openat(dirfd, de_name, O_RDONLY | O_NOFOLLOW);
- if (fd == -1)
- return got_error_from_errno2("openat", abspath);
+ if (fd == -1) {
+ err = got_error_from_errno2("openat", abspath);
+ goto done;
+ }
}
f = fdopen(fd, "r");