From c07ce0602a7958299c7fbbf2a5b70d1510c03981 Mon Sep 17 00:00:00 2001 From: Ævar Arnfjörð Bjarmason Date: Tue, 8 Nov 2022 19:17:45 +0100 Subject: ls-files: fix a --with-tree memory leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Taylor Blau --- builtin/ls-files.c | 1 + 1 file changed, 1 insertion(+) (limited to 'builtin/ls-files.c') 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); -- cgit 1.2.3-korg