]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sparse-checkout: free string list after displaying
authorJeff King <peff@peff.net>
Tue, 4 Jun 2024 10:13:37 +0000 (06:13 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Jun 2024 16:51:43 +0000 (09:51 -0700)
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>
builtin/sparse-checkout.c

index fb43bb7577144380a3669904485d2a6ed399dfd8..e648e035abf61718feb925e625853cd9ea45ef17 100644 (file)
@@ -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);
        }