summaryrefslogtreecommitdiffstats
path: root/builtin/fsck.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-02-15 23:55:41 +0100
committerJunio C Hamano <gitster@pobox.com>2018-02-15 23:55:41 +0100
commit52b7ab31d08d3e29870f7085c64de936e109f05d (patch)
treef5d33da660c35c36d8728a6ab700671bbaa92efa /builtin/fsck.c
parentMerge branch 'en/merge-recursive-fixes' (diff)
parentfsck: fix leak when traversing trees (diff)
downloadgit-52b7ab31d08d3e29870f7085c64de936e109f05d.tar.xz
git-52b7ab31d08d3e29870f7085c64de936e109f05d.zip
Merge branch 'jt/fsck-code-cleanup'
Plug recently introduced leaks in fsck. * jt/fsck-code-cleanup: fsck: fix leak when traversing trees
Diffstat (limited to 'builtin/fsck.c')
-rw-r--r--builtin/fsck.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 7a8a679d4f..9981db2263 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)