Merge branch 'jm/svn-pushmergeinfo-fix' into maint
[gitweb.git] / bisect.c
index de551c6d5ecef5cfb9d04e836854750ef08741c4..2f3008b07866fb7bda6c0e0bbb089b1be1271a1a 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -229,8 +229,10 @@ static struct commit_list *best_bisection_sorted(struct commit_list *list, int n
                if (i < cnt - 1)
                        p = p->next;
        }
-       free_commit_list(p->next);
-       p->next = NULL;
+       if (p) {
+               free_commit_list(p->next);
+               p->next = NULL;
+       }
        strbuf_release(&buf);
        free(array);
        return list;
@@ -1073,7 +1075,7 @@ int bisect_clean_state(void)
        struct string_list refs_for_removal = STRING_LIST_INIT_NODUP;
        for_each_ref_in("refs/bisect", mark_for_removal, (void *) &refs_for_removal);
        string_list_append(&refs_for_removal, xstrdup("BISECT_HEAD"));
-       result = delete_refs("bisect: remove", &refs_for_removal, REF_NODEREF);
+       result = delete_refs("bisect: remove", &refs_for_removal, REF_NO_DEREF);
        refs_for_removal.strdup_strings = 1;
        string_list_clear(&refs_for_removal, 0);
        unlink_or_warn(git_path_bisect_expected_rev());