From: "Rubén Justo" <rjusto@gmail.com>
To: Git List <git@vger.kernel.org>
Subject: [PATCH 2/4] add-interactive: plug a leak in get_untracked_files
Date: Sun, 21 Apr 2024 12:27:06 +0200 [thread overview]
Message-ID: <88b119aa-c1c2-435a-baaa-9422388bf0ec@gmail.com> (raw)
In-Reply-To: <b7b2d0d2-245e-440f-a7cc-fa0df1ce73ad@gmail.com>
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.
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;
}
--
2.45.0.rc0.4.g08f77eb516
next prev parent reply other threads:[~2024-04-21 10:27 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 ` Rubén Justo [this message]
2024-04-22 15:50 ` [PATCH 2/4] add-interactive: plug a leak in get_untracked_files Junio C Hamano
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=88b119aa-c1c2-435a-baaa-9422388bf0ec@gmail.com \
--to=rjusto@gmail.com \
--cc=git@vger.kernel.org \
/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).