object: clear grafts when clearing parsed object pool
We do not clear grafts part of the parsed object pool when clearing the pool itself, which can lead to memory leaks when a repository is being cleared. Fix this by moving `reset_commit_grafts()` into "object.c" and making it part of the `struct parsed_object_pool` interface such that we can call it from `parsed_object_pool_clear()`. Adapt `parsed_object_pool_new()` to take and store a reference to its owning repository, which is needed by `unparse_commit()`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
b8849e236f
commit
0d1d22f5a3
@@ -97,7 +97,7 @@ static void reset_repository_shallow(struct repository *r)
|
||||
{
|
||||
r->parsed_objects->is_shallow = -1;
|
||||
stat_validity_clear(r->parsed_objects->shallow_stat);
|
||||
reset_commit_grafts(r);
|
||||
parsed_object_pool_reset_commit_grafts(r->parsed_objects);
|
||||
}
|
||||
|
||||
int commit_shallow_file(struct repository *r, struct shallow_lock *lk)
|
||||
|
||||
Reference in New Issue
Block a user