]> Kevux Git Server - rit/commitdiff
builtin/repack: fix leaking keep-pack list
authorPatrick Steinhardt <ps@pks.im>
Thu, 5 Sep 2024 10:09:41 +0000 (12:09 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Sep 2024 15:49:13 +0000 (08:49 -0700)
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>
builtin/repack.c
t/t6500-gc.sh
t/t7703-repack-geometric.sh

index 2b9bf03..367e970 100644 (file)
@@ -1525,6 +1525,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
        }
 
 cleanup:
+       string_list_clear(&keep_pack_list, 0);
        string_list_clear(&names, 1);
        existing_packs_release(&existing);
        free_pack_geometry(&geometry);
index 1b5909d..58654b3 100755 (executable)
@@ -3,6 +3,7 @@
 test_description='basic git gc tests
 '
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-terminal.sh
 
index 9fc1626..8877aea 100755 (executable)
@@ -2,6 +2,7 @@
 
 test_description='git repack --geometric works correctly'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 GIT_TEST_MULTI_PACK_INDEX=0