From: Junio C Hamano <gitster@pobox.com>
To: "Rubén Justo" <rjusto@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 2/4] add-interactive: plug a leak in get_untracked_files
Date: Mon, 22 Apr 2024 08:50:01 -0700 [thread overview]
Message-ID: <xmqqwmopxuqe.fsf@gitster.g> (raw)
In-Reply-To: <88b119aa-c1c2-435a-baaa-9422388bf0ec@gmail.com> ("Rubén Justo"'s message of "Sun, 21 Apr 2024 12:27:06 +0200")
Rubén Justo <rjusto@gmail.com> writes:
> Plug a leak we have since ab1e1cccaf (built-in add -i: re-implement
> `add-untracked` in C, 2019-11-29).
>
> This leak can be triggered with:
>
> $ echo a | git add -i
>
> As a curiosity, we have a somewhat similar function in builtin/stash.c,
> which correctly frees the memory.
Yup,
$ git grep -W -e fill_directory -e dir_clear -e setup_standard_excludes \*.c
makes an interesting read ;-)
The fix looks good. Thanks.
> Signed-off-by: Rubén Justo <rjusto@gmail.com>
> ---
> add-interactive.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/add-interactive.c b/add-interactive.c
> index 6bf87e7ae7..e17602b5e4 100644
> --- a/add-interactive.c
> +++ b/add-interactive.c
> @@ -865,6 +865,7 @@ static int get_untracked_files(struct repository *r,
> }
>
> strbuf_release(&buf);
> + dir_clear(&dir);
> return 0;
> }
next prev parent reply other threads:[~2024-04-22 15:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-21 10:22 [PATCH 0/4] mark t3701-add-interactive.sh as leak-free Rubén Justo
2024-04-21 10:27 ` [PATCH 2/4] add-interactive: plug a leak in get_untracked_files Rubén Justo
2024-04-22 15:50 ` Junio C Hamano [this message]
2024-04-21 10:28 ` [PATCH 1/4] apply: plug a leak in apply_data Rubén Justo
2024-04-22 15:41 ` Phillip Wood
2024-04-22 22:04 ` Rubén Justo
2024-04-22 22:27 ` Junio C Hamano
2024-04-21 10:28 ` [PATCH 3/4] add-patch: plug a leak handling the '/' command Rubén Justo
2024-04-21 10:29 ` [PATCH 4/4] add: plug a leak on interactive_add Rubén Justo
2024-04-22 15:43 ` Phillip Wood
2024-04-22 23:04 ` Rubén Justo
2024-04-22 6:06 ` [PATCH 0/4] mark t3701-add-interactive.sh as leak-free Patrick Steinhardt
2024-04-22 15:30 ` Junio C Hamano
2024-04-22 22:51 ` [PATCH v2 " Rubén Justo
2024-04-22 22:54 ` [PATCH v2 1/4] apply: plug a leak in apply_data Rubén Justo
2024-04-22 22:54 ` [PATCH v2 2/4] add-interactive: plug a leak in get_untracked_files Rubén Justo
2024-04-22 22:54 ` [PATCH v2 3/4] add-patch: plug a leak handling the '/' command Rubén Justo
2024-04-22 22:54 ` [PATCH v2 4/4] add: plug a leak on interactive_add Rubén Justo
2024-04-22 23:26 ` [PATCH v2 0/4] mark t3701-add-interactive.sh as leak-free Junio C Hamano
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqwmopxuqe.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=rjusto@gmail.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).