[PATCH 06/16] reachable: clear pending array after walking it
- From
Jeff King <peff@peff.net>
- Date
- Oct 3, 2014, 20:24 UTC
- Message-ID
- <20141003202428.GF16293@peff.net>
- In-Reply-To
- <20141003202045.GA15205@peff.net>
We add a number of objects to our "pending" array, and then process it with a combination of get_revision and walking the pending array ourselves (to catch any non-commits). The commits in the pending array are cleaned up automatically by prepare_revision_walk, but we essentially leak any other objects (they are technically still reachable from rev_info, but no callers ever look at them or bother to clean them up).
This is not a huge deal in practice, as the number of non-commits tends to be small. However, a future patch will broaden this considerably. Let's call object_array_clear to free the memory.
Signed-off-by: Jeff King <peff@peff.net> --- reachable.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/reachable.c b/reachable.c index 6f6835b..d99bd31 100644 --- a/reachable.c +++ b/reachable.c @@ -131,6 +131,8 @@ static void walk_commit_list(struct rev_info *revs, } die("unknown pending object %s (%s)", sha1_to_hex(obj->sha1), name); } + + object_array_clear(&revs->pending); } static int add_one_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
-- 2.1.1.566.gdb1f904