aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/sparse-checkout.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2024-06-04 06:13:37 -0400
committerJunio C Hamano <gitster@pobox.com>2024-06-05 09:51:43 -0700
commita544b7da2c91f07c6d22d9c0b72911d32f836c54 (patch)
tree00f692963a9477876dbec563ad68c19bd1613355 /builtin/sparse-checkout.c
parentsparse-checkout: free pattern list in sparse_checkout_list() (diff)
downloadgit-a544b7da2c91f07c6d22d9c0b72911d32f836c54.tar.gz
git-a544b7da2c91f07c6d22d9c0b72911d32f836c54.zip
sparse-checkout: free string list after displaying
In sparse_checkout_list(), we put the hashmap entries into a string_list so we can sort them. But after printing, we forget to free the list. This patch drops 5 leaks from t1091. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/sparse-checkout.c')
-rw-r--r--builtin/sparse-checkout.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
index fb43bb7577..e648e035ab 100644
--- a/builtin/sparse-checkout.c
+++ b/builtin/sparse-checkout.c
@@ -95,6 +95,8 @@ static int sparse_checkout_list(int argc, const char **argv, const char *prefix)
quote_c_style(sl.items[i].string, NULL, stdout, 0);
printf("\n");
}
+
+ string_list_clear(&sl, 0);
} else {
write_patterns_to_file(stdout, &pl);
}