Commit Diff


commit - 20d96a10d5e54c5ff61a9ce5a53439d063a0805c
commit + d4b2e62d5cb4bd0757706877687d1c2bcb15f30c
blob - bcfa1a05fd35d1354207a86c2d0bd1c610dd3877
blob + 6d77ee58bbd3cfb9ef5c680a11dd856c3e64dff9
--- lib/worktree.c
+++ lib/worktree.c
@@ -7945,6 +7945,7 @@ got_worktree_histedit_continue(struct got_object_id **
 
 	*commit_id = NULL;
 	*tmp_branch = NULL;
+	*branch_ref = NULL;
 	*base_commit_id = NULL;
 	*fileindex = NULL;
 
@@ -8020,6 +8021,10 @@ done:
 			got_ref_close(*tmp_branch);
 			*tmp_branch = NULL;
 		}
+		if (*branch_ref) {
+			got_ref_close(*branch_ref);
+			*branch_ref = NULL;
+		}
 		if (*fileindex) {
 			got_fileindex_free(*fileindex);
 			*fileindex = NULL;