]> git.ipfire.org Git - thirdparty/git.git/commitdiff
builtin/pack-objects: plug leaking list of keep-packs
authorPatrick Steinhardt <ps@pks.im>
Thu, 5 Sep 2024 10:09:26 +0000 (12:09 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Sep 2024 15:49:12 +0000 (08:49 -0700)
The `--keep-pack` option of git-pack-objects(1) populates the arguments
into a string list. And while the list is marked as `NODUP` and thus
won't duplicate the strings, the list entries themselves still need to
be free'd. We don't though, causing a leak.

Plug it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c
t/t5616-partial-clone.sh

index c481feadbfa738698c19de25a3c3a5dd1c1b34c1..ab78d72e2733ba444a6db760a7819a95bdc1a3e5 100644 (file)
@@ -4641,6 +4641,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 cleanup:
        clear_packing_data(&to_pack);
        list_objects_filter_release(&filter_options);
+       string_list_clear(&keep_pack_list, 0);
        strvec_clear(&rp);
 
        return 0;
index 2da7291e37997a8b967788ee65c628ecf343b082..467c46dccf6aee6071af4f049f433b88b34555f2 100755 (executable)
@@ -5,6 +5,7 @@ test_description='git partial clone'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 # create a normal "src" repo where we can later create new commits.