aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/ls-files.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-11-08 19:17:45 +0100
committerJunio C Hamano <gitster@pobox.com>2022-11-21 12:32:48 +0900
commitc07ce0602a7958299c7fbbf2a5b70d1510c03981 (patch)
tree61fdb25eba8c27df5d542ddbaacc0d06113635bc /builtin/ls-files.c
parentfc47252d5b36fe2267e34aa9471dd7bb37d40545 (diff)
downloadgit-c07ce0602a7958299c7fbbf2a5b70d1510c03981.tar.gz
ls-files: fix a --with-tree memory leak
Fix a memory leak in overlay_tree_on_index(), we need to clear_pathspec() at some point, which might as well be after the last time we use it in the function. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'builtin/ls-files.c')
-rw-r--r--builtin/ls-files.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 4cf8a23648..a03b559eca 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -613,6 +613,7 @@ void overlay_tree_on_index(struct index_state *istate,
if (!fn)
fn = read_one_entry_quick;
err = read_tree(the_repository, tree, &pathspec, fn, istate);
+ clear_pathspec(&pathspec);
if (err)
die("unable to read tree entries %s", tree_name);