builtin/repack: fix leaking keep-pack list

The list of packs to keep is populated via a command line option but never free'd. Plug this memory leak. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Sep 5, 2024 at 12:09 UTC 46f6ca2a68e02dd68132ed0b64cd55a8b6569e29
3 files changed +3
builtin/repack.c
+1
@@ -1525,6 +1525,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
1525 }
1526
1527 cleanup:
1528 + string_list_clear(&keep_pack_list, 0);
1529 string_list_clear(&names, 1);
1530 existing_packs_release(&existing);
1531 free_pack_geometry(&geometry);
t/t6500-gc.sh
+1
@@ -3,6 +3,7 @@
3 test_description='basic git gc tests
4 '
5
6 +TEST_PASSES_SANITIZE_LEAK=true
7 . ./test-lib.sh
8 . "$TEST_DIRECTORY"/lib-terminal.sh
9
t/t7703-repack-geometric.sh
+1
@@ -2,6 +2,7 @@
2
3 test_description='git repack --geometric works correctly'
4
5 +TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 GIT_TEST_MULTI_PACK_INDEX=0