Commit Diff


commit - ec405b99414136a277c6d2bc223a538d9d701ccc
commit + a854b8c994a1381e4c6f2ba45bef9c22da0ec956
blob - fc674d163162822cb326fcd1144a79b40778c452
blob + f3dd65c0798d2e84fb8a2d174be5c350115e06a1
--- lib/worktree.c
+++ lib/worktree.c
@@ -7948,6 +7948,7 @@ got_worktree_histedit_continue(struct got_object_id **
 
 	*commit_id = NULL;
 	*tmp_branch = NULL;
+	*branch_ref = NULL;
 	*base_commit_id = NULL;
 	*fileindex = NULL;
 
@@ -8023,6 +8024,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;