Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2023-11-06 13:45:57 +0300
committerJunio C Hamano <gitster@pobox.com>2023-11-07 02:51:41 +0300
commit568cc818cc26955eb0b94084d3068caabab1edd7 (patch)
tree31bb0211188367332ee7afbd273779b25d72cf20 /shallow.c
parent40e9136ff641682e2ef739a3dbce03047ed5426f (diff)
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>
Diffstat (limited to 'shallow.c')
-rw-r--r--shallow.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/shallow.c b/shallow.c
index 5413719fd4..ac728cdd77 100644
--- a/shallow.c
+++ b/shallow.c
@@ -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);
}