aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/add.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-04-25 10:34:24 -0700
committerJunio C Hamano <gitster@pobox.com>2024-04-25 10:34:24 -0700
commite326e520101dcf43a0499c3adc2df7eca30add2d (patch)
tree0ccc11db7a48e18541d6dd4556d0a59c09f80770 /builtin/add.c
parentc9d1ee7cdf08f8915ed4fdd9571ecf901d074e85 (diff)
parent16727404c48ba1c2f43fb966276aee0b8cb24389 (diff)
downloadgit-e326e520101dcf43a0499c3adc2df7eca30add2d.tar.gz
Merge branch 'rj/add-i-leak-fix'
Leakfix. * rj/add-i-leak-fix: add: plug a leak on interactive_add add-patch: plug a leak handling the '/' command add-interactive: plug a leak in get_untracked_files apply: plug a leak in apply_data
Diffstat (limited to 'builtin/add.c')
-rw-r--r--builtin/add.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin/add.c b/builtin/add.c
index ae723bc85e..b7d3ff1e28 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -150,7 +150,7 @@ static int refresh(int verbose, const struct pathspec *pathspec)
int interactive_add(const char **argv, const char *prefix, int patch)
{
struct pathspec pathspec;
- int unused;
+ int unused, ret;
if (!git_config_get_bool("add.interactive.usebuiltin", &unused))
warning(_("the add.interactive.useBuiltin setting has been removed!\n"
@@ -163,9 +163,12 @@ int interactive_add(const char **argv, const char *prefix, int patch)
prefix, argv);
if (patch)
- return !!run_add_p(the_repository, ADD_P_ADD, NULL, &pathspec);
+ ret = !!run_add_p(the_repository, ADD_P_ADD, NULL, &pathspec);
else
- return !!run_add_i(the_repository, &pathspec);
+ ret = !!run_add_i(the_repository, &pathspec);
+
+ clear_pathspec(&pathspec);
+ return ret;
}
static int edit_patch(int argc, const char **argv, const char *prefix)