1
0
mirror of https://github.com/git/git synced 2024-07-02 15:48:44 +00:00

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>
This commit is contained in:
Jeff King 2024-06-04 06:13:37 -04:00 committed by Junio C Hamano
parent 521e04e6e8
commit a544b7da2c

View 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);
}