Commit 3d1a1e4cbc91e39df83eb35eb3df3cc87719a0b5

Stefan Sperling 2022-04-13T19:35:01

fix a double-free in an error case of cmd_checkout()

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/got/got.c b/got/got.c
index 634d14f..879f86c 100644
--- a/got/got.c
+++ b/got/got.c
@@ -2993,7 +2993,6 @@ cmd_checkout(int argc, char *argv[])
 		error = check_linear_ancestry(commit_id,
 		    got_worktree_get_base_commit_id(worktree), 0, repo);
 		if (error != NULL) {
-			free(commit_id);
 			if (error->code == GOT_ERR_ANCESTRY) {
 				error = checkout_ancestry_error(
 				    head_ref, commit_id_str);