diff mbox series

[22/22] builtin/repack: fix leaking keep-pack list

Message ID 3d30c727fbcb930f34f363a72cf4fbf7168b7504.1724656120.git.ps@pks.im (mailing list archive)
State Superseded
Headers show
Series Memory leak fixes (pt.6) | expand

Commit Message

Patrick Steinhardt Aug. 26, 2024, 7:22 a.m. UTC
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>
---
 builtin/repack.c            | 1 +
 t/t6500-gc.sh               | 1 +
 t/t7703-repack-geometric.sh | 1 +
 3 files changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/builtin/repack.c b/builtin/repack.c
index a382754feee..3ee8cfa732f 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -1543,6 +1543,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);
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index 1b5909d1b70..58654b3437e 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -3,6 +3,7 @@ 
 test_description='basic git gc tests
 '
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-terminal.sh
 
diff --git a/t/t7703-repack-geometric.sh b/t/t7703-repack-geometric.sh
index 9fc1626fbfd..8877aea98ba 100755
--- a/t/t7703-repack-geometric.sh
+++ b/t/t7703-repack-geometric.sh
@@ -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