diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-04-25 10:34:24 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-04-25 10:34:24 -0700 |
commit | e326e520101dcf43a0499c3adc2df7eca30add2d (patch) | |
tree | 0ccc11db7a48e18541d6dd4556d0a59c09f80770 /builtin/add.c | |
parent | c9d1ee7cdf08f8915ed4fdd9571ecf901d074e85 (diff) | |
parent | 16727404c48ba1c2f43fb966276aee0b8cb24389 (diff) | |
download | git-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.c | 9 |
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) |