Commit Diff
--- lib/worktree.c +++ lib/worktree.c @@ -1210,7 +1210,7 @@ get_file_status(unsigned char *status, struct stat *sb done: if (blob) got_object_blob_close(blob); - if (f) + if (f != NULL && fclose(f) == EOF && err == NULL) fclose(f); if (fd != -1 && close(fd) == -1 && err == NULL) err = got_error_from_errno2("close", abspath);