summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-03-22 21:24:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-22 21:24:12 (GMT)
commitd78b7eb2d50bd1cf57d7f06c1b4bdd8e08057926 (patch)
treede93ab1fc46b8aadba6ca8b60d41b5cecf2b1e1e /builtin
parent34b9ec8dd9bf6d3f6fa04f295351f917042a33fa (diff)
parentba3a08ca0ec0d800d2fdbe73984927c1d8199082 (diff)
downloadgit-d78b7eb2d50bd1cf57d7f06c1b4bdd8e08057926.zip
git-d78b7eb2d50bd1cf57d7f06c1b4bdd8e08057926.tar.gz
git-d78b7eb2d50bd1cf57d7f06c1b4bdd8e08057926.tar.bz2
Merge branch 'jt/fsck-code-cleanup' into maint
Plug recently introduced leaks in fsck. * jt/fsck-code-cleanup: fsck: fix leak when traversing trees
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fsck.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 04846d4..92ce775 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -171,7 +171,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)