diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2006-08-26 22:38:02 -0400 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-01-14 02:15:08 -0500 |
commit | 2eb26d8454de77f45bbbfc32eed2a6c3133fe963 (patch) | |
tree | 6e754f1d2e84821f6f6386cc7da06e1d1d3ae628 | |
parent | Added --branch-log to option to fast-import. (diff) | |
download | tgif-2eb26d8454de77f45bbbfc32eed2a6c3133fe963.tar.xz |
Fixed GPF in fast-import caused by unterminated linked list.
fast-import was encounting a GPF when it ran out of free tree_entry
objects but didn't know this was the cause because the last
tree_entry wasn't terminated with a NULL pointer. The missing NULL
pointer occurred when we allocated additional entries via xmalloc
but didn't set the last tree_entry's "next" pointer to NULL.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r-- | fast-import.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; |