]> git.ipfire.org Git - thirdparty/git.git/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 2b9bf0318ad5ed7a62b38722da783394dd83963a..367e970dcfa2db28bbbd694b67149cbf11e0123a 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 1b5909d1b70bb0f02bdff6f40c778022ede1af25..58654b3437edf3e6f24b236ed40bff9bf992159e 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 9fc1626fbfde8989348537903a266eb6cae8600d..8877aea98ba863dd7bf2f6123aabb6aa48995296 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