mirror of
https://github.com/git/git
synced 2024-11-05 01:58:18 +00:00
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:
parent
40e9136ff6
commit
568cc818cc
3 changed files with 6 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
test_description='check bitmap operation with shallow repositories'
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
# We want to create a situation where the shallow, grafted
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
test_description='errors in upload-pack'
|
||||
|
||||
TEST_PASSES_SANITIZE_LEAK=true
|
||||
. ./test-lib.sh
|
||||
|
||||
D=$(pwd)
|
||||
|
|
Loading…
Reference in a new issue