[PATCH 01/16] list-objects: mark tree as unparsed when we free its buffer
- From
Vicent Marti <tanoku@gmail.com>
- Date
- Jun 24, 2013, 23:22 UTC
- Message-ID
- <1372116193-32762-2-git-send-email-tanoku@gmail.com>
- In-Reply-To
- <1372116193-32762-1-git-send-email-tanoku@gmail.com>
From: Jeff King <peff@peff.net>
We free the tree buffer during traversal to save memory. However, we do not reset the "parsed" flag, which leaves a landmine for the next person to use the tree. When they call parse_tree it will do nothing, and they will segfault when they try to access the buffer.
This hasn't mattered until now because most rev-list traversals would exit the program immediately afterwards, but the bitmap writer wants to access the trees twice. --- list-objects.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/list-objects.c b/list-objects.c index 3dd4a96..1251180 100644 --- a/list-objects.c +++ b/list-objects.c @@ -125,6 +125,7 @@ static void process_tree(struct rev_info *revs, strbuf_setlen(base, baselen); free(tree->buffer); tree->buffer = NULL; + tree->object.parsed = 0; } static void mark_edge_parents_uninteresting(struct commit *commit,
-- 1.7.9.5