Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
fsck: fix leak when traversing trees
author
Eric Wong
<e@80x24.org>
Sat, 20 Jan 2018 07:43:51 +0000
(07:43 +0000)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 23 Jan 2018 18:18:37 +0000
(10:18 -0800)
While fsck_walk/fsck_walk_tree/parse_tree populates "struct tree"
idempotently, it is still up to the fsck_walk caller to call
free_tree_buffer.
Fixes:
ad2db4030e42890e
("fsck: remove redundant parse_tree() invocation")
Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fsck.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
78e7b98
)
diff --git
a/builtin/fsck.c
b/builtin/fsck.c
index 64542ac3dea48e3a92901319233aa3a1e0c4cb9a..5aa4a1b336563313f1e17e57c9049699442a8a63 100644
(file)
--- a/
builtin/fsck.c
+++ b/
builtin/fsck.c
@@
-170,7
+170,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)