summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 264244a)
raw | patch | inline | side by side (parent: 264244a)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 27 Aug 2006 02:38:02 +0000 (22:38 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 14 Jan 2007 07:15:08 +0000 (02:15 -0500) |
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>
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>
fast-import.c | patch | blob | history |
diff --git a/fast-import.c b/fast-import.c
index 8328e004bb2fad1c1a7a831fedf0ef2aab5c21f7..194116be6f7951df32d0770d0901533887a59025 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
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;