diff --git a/fast-import.c b/fast-import.c index 8328e004bb..194116be6f 100644 --- a/fast-import.c +++ b/fast-import.c @@ -520,10 +520,11 @@ static struct tree_entry* new_tree_entry() unsigned int n = tree_entry_alloc; total_allocd += n * sizeof(struct tree_entry); avail_tree_entry = e = xmalloc(n * sizeof(struct tree_entry)); - while (n--) { + while (n-- > 1) { *((void**)e) = e + 1; e++; } + *((void*)e) = NULL; } e = avail_tree_entry;