[PATCH 12/13] sparse-checkout: free string list after displaying
- From
Jeff King <peff@peff.net>
- Date
- May 31, 2024, 11:36 UTC
- Message-ID
- <20240531113643.GL428814@coredump.intra.peff.net>
- In-Reply-To
- <20240531112433.GA428583@coredump.intra.peff.net>
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> --- builtin/sparse-checkout.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c index bc07df925f..0b979a17d6 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); }
-- 2.45.1.727.ge984192922