Commit a06ff56fe6d05906b4a5c515605b1196b3479d1f

Christian Weisgerber 2021-01-21T18:33:50

fix a use after free() ok jrick stsp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/lib/worktree.c b/lib/worktree.c
index 5dfe5fb..f846908 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -510,8 +510,8 @@ got_worktree_close(struct got_worktree *worktree)
 	free(worktree->root_path);
 	free(worktree->gotconfig_path);
 	got_gotconfig_free(worktree->gotconfig);
-	free(worktree);
 	close(worktree->root_fd);
+	free(worktree);
 	return err;
 }