Git 2.16-rc2
[gitweb.git] / bisect.c
index 0fca17c02bba89d6c65df95e03e88ef6dd02971e..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;