From: Junio C Hamano <gitster@pobox.com>
To: Eric Wong <e@80x24.org>
Cc: git@vger.kernel.org, Jonathan Tan <jonathantanmy@google.com>
Subject: Re: [PATCH] fsck: fix leak when traversing trees
Date: Tue, 23 Jan 2018 10:18:24 -0800 [thread overview]
Message-ID: <xmqqpo60iglr.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20180120074351.GA12439@whir> (Eric Wong's message of "Sat, 20 Jan 2018 07:43:51 +0000")
Eric Wong <e@80x24.org> writes:
> 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")
Yup, we can see that that commit did stop freeing the tree buffer.
Thanks.
>
> Signed-off-by: Eric Wong <e@80x24.org>
> ---
> These APIs could probably be made to be less error-prone,
> but at least this stops my little machine from OOM-ing.
>
> builtin/fsck.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/fsck.c b/builtin/fsck.c
> index 04846d46f9..92ce775a74 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)
prev parent reply other threads:[~2018-01-23 18:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-20 7:43 [PATCH] fsck: fix leak when traversing trees Eric Wong
2018-01-23 18:18 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqpo60iglr.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=e@80x24.org \
--cc=git@vger.kernel.org \
--cc=jonathantanmy@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.