Commit Diff


commit - 3605a8140cfc3c18e051b6af5ebb6fb404968853
commit + 5ade8233f4089c3f88f175be2fcedda9595fe842
blob - 4a682d42af7719b25a8ec3735f15f04f85e91a2e
blob + 9948e88721de975b38546a1ede8b343374dea52d
--- lib/worktree.c
+++ lib/worktree.c
@@ -1684,7 +1684,8 @@ done:
 		got_object_tree_close(tree);
 	if (commit)
 		got_object_commit_close(commit);
-	got_fileindex_free(fileindex);
+	if (fileindex)
+		got_fileindex_free(fileindex);
 	unlockerr = lock_worktree(worktree, LOCK_SH);
 	if (unlockerr && err == NULL)
 		err = unlockerr;
@@ -3975,7 +3976,8 @@ got_worktree_rebase_abort(struct got_worktree *worktre
 done:
 	got_ref_close(resolved);
 	free(commit_id);
-	got_fileindex_free(fileindex);
+	if (fileindex)
+		got_fileindex_free(fileindex);
 	free(fileindex_path);
 	TAILQ_FOREACH(pe, &revertible_paths, entry)
 		free((char *)pe->path);