shallow: fix memory leak when registering shallow roots
When registering shallow roots, we unset the list of parents of the to-be-registered commit if it's already been parsed. This causes us to leak memory though because we never free this list. Fix this. 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
40e9136ff6
commit
568cc818cc
@ -38,8 +38,10 @@ int register_shallow(struct repository *r, const struct object_id *oid)
|
||||
|
||||
oidcpy(&graft->oid, oid);
|
||||
graft->nr_parent = -1;
|
||||
if (commit && commit->object.parsed)
|
||||
if (commit && commit->object.parsed) {
|
||||
free_commit_list(commit->parents);
|
||||
commit->parents = NULL;
|
||||
}
|
||||
return register_commit_graft(r, graft, 0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user