summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-02-15 22:55:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-02-15 22:55:41 (GMT)
commit52b7ab31d08d3e29870f7085c64de936e109f05d (patch)
treef5d33da660c35c36d8728a6ab700671bbaa92efa
parentae0d0795d736467202d9bfd535942be81529f84e (diff)
parentba3a08ca0ec0d800d2fdbe73984927c1d8199082 (diff)
downloadgit-52b7ab31d08d3e29870f7085c64de936e109f05d.zip
git-52b7ab31d08d3e29870f7085c64de936e109f05d.tar.gz
git-52b7ab31d08d3e29870f7085c64de936e109f05d.tar.bz2
Merge branch 'jt/fsck-code-cleanup'
Plug recently introduced leaks in fsck. * jt/fsck-code-cleanup: fsck: fix leak when traversing trees
-rw-r--r--builtin/fsck.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 7a8a679..9981db2 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -180,7 +180,13 @@ static void mark_object_reachable(struct object *obj)
static int traverse_one_object(struct object *obj)
{
- return fsck_walk(obj, obj, &fsck_walk_options);
+ int result = fsck_walk(obj, obj, &fsck_walk_options);
+
+ if (obj->type == OBJ_TREE) {
+ struct tree *tree = (struct tree *)obj;
+ free_tree_buffer(tree);
+ }
+ return result;
}
static int traverse_reachable(void)