commit - e7abd6b665c4cff5b07ed20382f14cc1b5775c5c
commit + 60e40e9508a5c419b43c5c0d32f9a3af81546463
blob - 293cbc6e16de48dd0ff2f37169051429fd6e2493
blob + 686148327a8e13cf481ef62f03fe15ba6a6841d0
--- lib/worktree.c
+++ lib/worktree.c
got_worktree_close(struct got_worktree *worktree)
{
const struct got_error *err = NULL;
- free(worktree->repo_path);
- free(worktree->path_prefix);
- free(worktree->base_commit_id);
- free(worktree->head_ref_name);
+
if (worktree->lockfd != -1) {
if (close(worktree->lockfd) == -1)
err = got_error_from_errno2("close",
got_worktree_get_root_path(worktree));
}
- free(worktree->root_path);
- free(worktree->gotconfig_path);
- got_gotconfig_free(worktree->gotconfig);
if (close(worktree->root_fd) == -1 && err == NULL)
err = got_error_from_errno2("close",
got_worktree_get_root_path(worktree));
+ free(worktree->repo_path);
+ free(worktree->path_prefix);
+ free(worktree->base_commit_id);
+ free(worktree->head_ref_name);
+ free(worktree->root_path);
+ free(worktree->gotconfig_path);
+ got_gotconfig_free(worktree->gotconfig);
free(worktree);
return err;
}